class ActiveRecord::Associations::Association
Private Instance Methods
build_record(attributes, options)
click to toggle source
# File lib/active_record/mass_assignment_security/associations.rb, line 8 def build_record(attributes, options) reflection.build_association(attributes, options) do |record| the_scope = (ActiveRecord::VERSION::STRING.to_f >= 5.2 ? scope_for_create : create_scope) attributes = the_scope.except(*(record.changed - [reflection.foreign_key])) record.assign_attributes(attributes, without_protection: true) end end