ArgumentError in tests with Rails 4.1.10rc2
rst opened this issue · comments
Running the tests on Ruby 2.1.5 with
gem 'rails', '4.1.10.rc2'
in the Gemfile yields the following error (attn: @rafaelfranca ):
- 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:inbuild_record' /home/rst/src/protected_attributes/lib/active_record/mass_assignment_security/associations.rb:72:in
build_record'
/home/rst/src/protected_attributes/lib/active_record/mass_assignment_security/associations.rb:19:inbuild' /home/rst/src/protected_attributes/lib/active_record/mass_assignment_security/associations.rb:55:in
build'
/home/rst/src/protected_attributes/test/attribute_sanitization_test.rb:687:in `test_has_many_through_build_with_attr_accessible_attributes'
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.)
fixed via #64
thanks