New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with the undecorate option for the new
form
#2199
Comments
I don't understand why it wouldn't respond to |
This was a long time ago. At that time, I monkey patched Thank you again for your time, and for the excellent work in pushing this gem forward. |
Okay, well at any rate thanks for the quick response. I'm trying to clean up the issue tracker so it's easier to manage. Hopefully you do :] |
I'm experiencing this with master on Rails 4. On the "new" page I get an "Undefined method model" error, so for the time being I've just put the following in my model: def model
self
end It'd be nice to see this fixed. :) |
Can you try debugging, and finding out what type of object |
I'm sorry, what do you mean exactly by "type of object"? |
I meant answering the question: if the resource object isn't a decoration, what is it? Hmm, I guess there's no point anyway. It seems pretty clear that the 'new' form's object simply isn't decorated. It'd be nice to know for sure though. |
Oh, the resource is just an object of the model class. |
# By Sean Linsley (153) and others # Via Sean Linsley (68) and others * 'master' of github.com:gregbell/active_admin: (293 commits) Fix nested resource name in breadcrumbs patch activeadmin#2199 Updated documentation. only load the parts of jQuery UI we're actually using JS cleanup simplify JS folder structure Update inline-docs on has-many js Fix broken has_many form html and javascript Cleanup options that shouldn't render as html attrs allow svg icons to be resized update CONTRIBUTING.md update tests so they work with Devise 3.2 Update zh-CN.yml ensure ActiveRecord is loaded when running tests Add missing translations to pt-BR locale add formalistic locale small docs update update 9-batch-actions.md update 8-custom-actions.md GFM docs update ... Conflicts: config/locales/en.yml lib/active_admin/form_builder.rb lib/active_admin/inputs/filter_string_input.rb lib/active_admin/resource/action_items.rb spec/unit/filters/filter_form_builder_spec.rb
…pecific-resources # By Sean Linsley (153) and others # Via Sean Linsley (68) and others * master: (297 commits) Fix nested resource name in breadcrumbs patch activeadmin#2199 Updated documentation. only load the parts of jQuery UI we're actually using JS cleanup simplify JS folder structure Update inline-docs on has-many js Fix broken has_many form html and javascript Cleanup options that shouldn't render as html attrs allow svg icons to be resized update CONTRIBUTING.md update tests so they work with Devise 3.2 Update zh-CN.yml ensure ActiveRecord is loaded when running tests Add missing translations to pt-BR locale add formalistic locale small docs update update 9-batch-actions.md update 8-custom-actions.md GFM docs update ... Conflicts: lib/active_admin/base_controller/translation.rb lib/active_admin/form_builder.rb
Im having the same issue, is this solved? |
Not yet, I will go back to this during the weekend... |
According to the docs, if a resource is decorated, the instance provided to
form_for
also gets decorated. However, this does not seem to be the case for thenew
action.Since passing the decorated instance to forms may cause problems (as explained in the docs), I need to use
decorate: false
, which internally callsmodel
to return the undecorated instance. It works for edits, but raises an "undefined method 'model' error" for thenew
action.Something like:
Prevents the exception from being raised, but does not fix the problem, which is the instantiated object is not decorated. Thanks for this awesome gem 👍
Note: I already added the fix for Draper +1.1 as explained in the wiki. I'm using AA from master and tested with Draper 1.0.0, 1.1.0 and 1.2.1.
The text was updated successfully, but these errors were encountered: