Skip to content

Commit

Permalink
default_url_options and ruby 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev committed Feb 28, 2024
1 parent 1ff81b7 commit 6dd39bf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/3.0/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,26 @@ end
Related:
- [Multitenancy](./multitenancy)
- [`Avo::Current`](./avo-current#tenant_id)

::::option `default_url_options`
`default_url_options` is a Rails [controller method](https://apidock.com/rails/ActionController/Base/default_url_options) that will append params automatically to the paths you generate through path helpers.

In order to implement some features like route-level Multitenancy we exposed an API to add to Avo's `default_url_options` method.

::: code-group
```ruby [config/initializers/avo.rb]{2}
Avo.configure do |config|
config.default_url_options = [:account_id]
end
```
```ruby [app/config/routes.rb]{3}
Rails.application.routes.draw do
# Use to test out route-based multitenancy
scope "/account/:account_id" do
mount Avo::Engine, at: Avo.configuration.root_path
end
end
```

Now, when you visit `https://example.org/account/adrian/avo`, the `account_id` param is `adrian` and it will be appended to all path helpers.
::::
4 changes: 4 additions & 0 deletions docs/3.0/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ These links might be in Tools, Resource Tools, Menu Items, or regular view parti
A quick search through your codebase should reveal them.
:::

## Upgrade from 3.3.0 to 3.4.0

Ruby 3.0 is end-of-life and we pushed some code that only works with Ruby 3.1.

## Upgrade from 3.2.2 to 3.3.0
:::option `may_download_file` deprecated
Actions now fully operate with turbo leading to the deprecation of `may_download_file` option. It can be safely removed from all actions.
Expand Down

0 comments on commit 6dd39bf

Please sign in to comment.