rails / protected_attributes

Protect attributes from mass-assignment in ActiveRecord models.
MIT License
228 stars 92 forks source link

ArgumentError in tests with Rails 4.1.10rc2 #63

Closed rst closed 9 years ago

rst commented 9 years ago

Running the tests on Ruby 2.1.5 with

gem 'rails', '4.1.10.rc2'

in the Gemfile yields the following error (attn: @rafaelfranca ):

1) Error: MassAssignmentSecurityHasManyRelationsTest#test_has_many_through_build_with_attr_accessible_attributes: ArgumentError: wrong number of arguments (2 for 1) /home/rst/gemhome215/gems/activerecord-4.1.10.rc2/lib/active_record/associations/through_association.rb:96:in build_record' /home/rst/src/protected_attributes/lib/active_record/mass_assignment_security/associations.rb:72:inbuild_record' /home/rst/src/protected_attributes/lib/active_record/mass_assignment_security/associations.rb:19:in build' /home/rst/src/protected_attributes/lib/active_record/mass_assignment_security/associations.rb:55:inbuild' /home/rst/src/protected_attributes/test/attribute_sanitization_test.rb:687:in `test_has_many_through_build_with_attr_accessible_attributes'

rst commented 9 years ago

See pull request #64 which fixes the issue. (Turns out that a new build_record method was added to the ThroughAssociation module, and protected_attributes needs to dink that to pass through the options hash -- if not, .create and .new on has_many :through associations breaks.)

arthurnn commented 9 years ago

fixed via https://github.com/rails/protected_attributes/pull/64

thanks