mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
chore: update upgrade guide
This commit is contained in:
parent
c90241fde2
commit
582b16476d
1 changed files with 5 additions and 7 deletions
|
@ -246,22 +246,20 @@ end
|
||||||
|
|
||||||
For those who want to be more explicit, or after your upgrade has complete if you wish to refactor existing resources and actions, the general best path forward is to copy the `default_accept` into each action (or put it in a module attribute and reference it) as the `accept` option. This way when a new action is added, it does not "inherit" some list of accepted attributes.
|
For those who want to be more explicit, or after your upgrade has complete if you wish to refactor existing resources and actions, the general best path forward is to copy the `default_accept` into each action (or put it in a module attribute and reference it) as the `accept` option. This way when a new action is added, it does not "inherit" some list of accepted attributes.
|
||||||
|
|
||||||
|
> ### :\* includes belongs_to attributes! {:.WARNING}
|
||||||
|
>
|
||||||
|
> The change to explicit accepts also included a change that defaults belongs_to attributes to `writable?: true` and `public?: true`. You may want to add `attribute_writable?: false` to your belongs_to relationships if you are adding `default_acceot :*` and don't currently have `attribute_writable?: true` on them currently.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Default actions `:create` and `:update` can now have an accept list
|
### Default actions `:create` and `:update` can now have an accept list
|
||||||
|
|
||||||
This accept list will be _required_ at compile time if the resource has `default_accept :*`. here is an example of how it is used:
|
For example:
|
||||||
|
|
||||||
```elixir
|
```elixir
|
||||||
defaults [:read, :destroy, create: :*, update: :*]
|
defaults [:read, :destroy, create: :*, update: :*]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### What you'll need to change
|
|
||||||
|
|
||||||
You will get compile time errors if you don't do this, so follow the errors and you'll get there. I suggest that each time you get an error, you go to the resource that caused the error, and copy and replace any instance of that same default accept list. That way you'll only need to do a couple of find and replaces. i.e
|
|
||||||
|
|
||||||
replace `defaults [:create, :read, :update, :destroy]` with `defaults [:read, :destroy, create: :*, update: :*]` and so on.
|
|
||||||
|
|
||||||
### Default read actions are now paginatable
|
### Default read actions are now paginatable
|
||||||
|
|
||||||
In 2.0, if you have `:read` in your default actions list, it would generate an action like this:
|
In 2.0, if you have `:read` in your default actions list, it would generate an action like this:
|
||||||
|
|
Loading…
Reference in a new issue