-
Notifications
You must be signed in to change notification settings - Fork 22k
The model_name
method should be called on to_model
#18647
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
Conversation
Actually I think we should call set |
Is there a reason it doesn't happen immediately when doing the https://github.com/rails/rails/blob/v4.2.0/actionview/lib/action_view/helpers/tags/base.rb#L41 |
I don't think so. Try it and see how tests responds to the change. |
Yeah, never mind, they blew up. I'll try to find that out for myself later. I'll just add the Thanks for the help :) |
b688687
to
505447f
Compare
Hmm... found very similar code here: https://github.com/rails/rails/blob/v4.2.0/actionview/lib/action_view/helpers/tags/label.rb#L20-L32 I'll try to clean that up |
505447f
to
c946b2a
Compare
Not too sure about that last commit. It reduces the duplication, but it could probably be done in a clearer way. |
The `model_name` method should be called on `to_model`
…AR form_for Refactoring at rails#18647 broke using non active record objects in form_for. This patch restores the original behaviour where we only compute i18 key when object.respond_to?(:to_model)
There is a bug in the merged version: @model = object.respond_to?(:to_model) ? object.to_model : object we should not set form_for(OpenStuct.new(....),) see #18834 |
…AR form_for Refactoring at rails#18647 broke using non active record objects in form_for. This patch restores the original behaviour where we only compute i18 key when object.respond_to?(:to_model)
See #18646
Should the same be done for the following lines? E.g.
model.respond_to?(:human_attribute_name)
https://github.com/rails/rails/blob/v4.2.0/actionview/lib/action_view/helpers/tags/placeholderable.rb#L22-L24