Skip to content

Instantly share code, notes, and snippets.

@zzak
Created June 13, 2014 21:21
Show Gist options
  • Save zzak/e50bedccee761e071bbb to your computer and use it in GitHub Desktop.
Save zzak/e50bedccee761e071bbb to your computer and use it in GitHub Desktop.
diff --git a/lib/active_record/mass_assignment_security/associations.rb b/lib/active_record/mass_assignment_security/associations.rb
index ade4d3a..c9cb0b8 100644
--- a/lib/active_record/mass_assignment_security/associations.rb
+++ b/lib/active_record/mass_assignment_security/associations.rb
@@ -16,7 +16,7 @@ module ActiveRecord
if attributes.is_a?(Array)
attributes.collect { |attr| build(attr, options, &block) }
else
- add_to_target(build_record(attributes, options)) do |record|
+ add_to_target(build_record(attributes, options.merge(without_protection: true))) do |record|
yield(record) if block_given?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment