many_to_many exception after updating Ash
Previous version was
Here are my resources:
Here's the error I'm getting:
2.6.312.6.31. I updated to 2.11.82.11.8 today and an existing many_to_manymany_to_many association that I had is now raising an exception. Did something change?Here are my resources:
defmodule MyApp.Budgeting.Book do
relationships do
many_to_many :users, MyApp.Authentication.User do
through MyApp.Budgeting.BookUser
api MyApp.Authentication
source_attribute_on_join_resource :book_id
destination_attribute_on_join_resource :user_id
end
end
enddefmodule MyApp.Budgeting.Book do
relationships do
many_to_many :users, MyApp.Authentication.User do
through MyApp.Budgeting.BookUser
api MyApp.Authentication
source_attribute_on_join_resource :book_id
destination_attribute_on_join_resource :user_id
end
end
enddefmodule MyApp.Authentication.User do
relationships do
many_to_many :books, MyApp.Budgeting.Book do
through MyApp.Budgeting.BookUser
api MyApp.Budgeting
source_attribute_on_join_resource :user_id
destination_attribute_on_join_resource :book_id
end
end
enddefmodule MyApp.Authentication.User do
relationships do
many_to_many :books, MyApp.Budgeting.Book do
through MyApp.Budgeting.BookUser
api MyApp.Budgeting
source_attribute_on_join_resource :user_id
destination_attribute_on_join_resource :book_id
end
end
enddefmodule MyApp.Budgeting.BookUser do
relationships do
belongs_to :book, MyApp.Budgeting.Book do
allow_nil? false
end
belongs_to :user, MyApp.Authentication.User do
api MyApp.Authentication
allow_nil? false
end
end
enddefmodule MyApp.Budgeting.BookUser do
relationships do
belongs_to :book, MyApp.Budgeting.Book do
allow_nil? false
end
belongs_to :user, MyApp.Authentication.User do
api MyApp.Authentication
allow_nil? false
end
end
endHere's the error I'm getting:
** (RuntimeError) Resource `MyApp.Budgeting.BookUser` is not accepted by api `MyApp.Authentication` for autogenerated join relationship: `:users_join_assoc`
Relationship was generated by the `many_to_many` relationship `:users`
If the `through` resource `MyApp.Budgeting.BookUser` is not accepted by the same
api as the destination resource `MyApp.Authentication.User`,
then you must define that relationship manually. To define it manually, add the following to your
relationships:
has_many :users_join_assoc, MyApp.Budgeting.BookUser do
# configure the relationship attributes
...
end
You can use a name other than `:users_join_assoc`, but if you do, make sure to
add that to `:users`, i.e
many_to_many :users_join_assoc, MyApp.Budgeting.BookUser do
...
join_relationship_name :your_new_name
end** (RuntimeError) Resource `MyApp.Budgeting.BookUser` is not accepted by api `MyApp.Authentication` for autogenerated join relationship: `:users_join_assoc`
Relationship was generated by the `many_to_many` relationship `:users`
If the `through` resource `MyApp.Budgeting.BookUser` is not accepted by the same
api as the destination resource `MyApp.Authentication.User`,
then you must define that relationship manually. To define it manually, add the following to your
relationships:
has_many :users_join_assoc, MyApp.Budgeting.BookUser do
# configure the relationship attributes
...
end
You can use a name other than `:users_join_assoc`, but if you do, make sure to
add that to `:users`, i.e
many_to_many :users_join_assoc, MyApp.Budgeting.BookUser do
...
join_relationship_name :your_new_name
end