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
Parameter wrapping doesn't support aliased attributes #10375
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -44,7 +44,7 @@ module ActionController | ||
# | # | ||
# On ActiveRecord models with no +:include+ or +:exclude+ option set, | # On ActiveRecord models with no +:include+ or +:exclude+ option set, | ||
# it will only wrap the parameters returned by the class method | # it will only wrap the parameters returned by the class method | ||
# <tt>attribute_names</tt>. | # <tt>attribute_method_names</tt>. | ||
# | # | ||
# If you're going to pass the parameters to an +ActiveModel+ object (such as | # If you're going to pass the parameters to an +ActiveModel+ object (such as | ||
# <tt>User.new(params[:user])</tt>), you might consider passing the model class to | # <tt>User.new(params[:user])</tt>), you might consider passing the model class to | ||
|
@@ -106,8 +106,8 @@ def include | ||
@include_set = true | @include_set = true | ||
|
|
||
unless super || exclude | unless super || exclude | ||
if m.respond_to?(:attribute_names) && m.attribute_names.any? | if m.respond_to?(:attribute_method_names) && m.attribute_method_names.any? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change seems to be causing a failure here: https://github.com/rails/rails/blob/master/actionpack/test/controller/params_wrapper_test.rb#L181-L191 Seems interesting. I guess if you have an abstract model, the |
|||
self.include = m.attribute_names | self.include = m.attribute_method_names | ||
end | end | ||
end | end | ||
end | end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to check
any?
before assigning?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not actually sure. It seems like you could unintentionally set
self.include
tonil
considering we set@include_set
totrue
outside the conditional. Hrm. I'll try removing that.