You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling param_key on an ActiveModel::Name that wraps a resource from an isolated engine, it will strip off the namespace for that engine. Because of this, it is important that ActiveAdmin uses the ActiveAdmin::Resource::Name#param_key proxy everywhere it needs the param key.
Now, 8872d84 claims to fix something, but I have to admit that I don't really understand what is being fixed. In any case, it breaks forms using resources from isolated engines.
As an example, say I have an isolated engine called Blog. It has a model called Post. Then, due to the way isolated engines work, this happens:
Blog::Post.model_name.param_key# => "post"
So, according to Rails, this is correct, but the controller for the Blog::Post resource will expect parameters for a resource called blog_post, not post and be unable to create/update the resource.
Note that this is specific to isolated engines. For a resource that has been defined in the main application, everything works fine (because ActiveModel::Naming doesn't remove the namespace on param_key). So if I define a Zoo namespace with a Zebra model in it (in the main app), it works as expected:
Zoo::Zebra.model_name.param_key# => "zoo_zebra"
The text was updated successfully, but these errors were encountered:
When calling
param_key
on an ActiveModel::Name that wraps a resource from an isolated engine, it will strip off the namespace for that engine. Because of this, it is important that ActiveAdmin uses theActiveAdmin::Resource::Name#param_key
proxy everywhere it needs the param key.Now, 8872d84 claims to fix something, but I have to admit that I don't really understand what is being fixed. In any case, it breaks forms using resources from isolated engines.
As an example, say I have an isolated engine called Blog. It has a model called Post. Then, due to the way isolated engines work, this happens:
So, according to Rails, this is correct, but the controller for the Blog::Post resource will expect parameters for a resource called
blog_post
, notpost
and be unable to create/update the resource.Note that this is specific to isolated engines. For a resource that has been defined in the main application, everything works fine (because ActiveModel::Naming doesn't remove the namespace on
param_key
). So if I define a Zoo namespace with a Zebra model in it (in the main app), it works as expected:The text was updated successfully, but these errors were encountered: