Permalink
Browse files

Active Record master uses #generated_association_methods.

  • Loading branch information...
1 parent be38ff2 commit 628a89e3d5194907fd9ccf8e61e793c59ef431ed @frodsan frodsan committed Dec 4, 2013
@@ -1,4 +1,9 @@
require "active_record"
+
+def active_record_41?
+ ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 1
+end
+
require "active_record/mass_assignment_security/associations"
require "active_record/mass_assignment_security/attribute_assignment"
require "active_record/mass_assignment_security/core"
@@ -24,10 +24,12 @@ def accepts_nested_attributes_for(*attr_names)
type = (reflection.collection? ? :collection : :one_to_one)
+ generated_methods_module = active_record_41? ? generated_association_methods : generated_feature_methods
+
# def pirate_attributes=(attributes)
# assign_nested_attributes_for_one_to_one_association(:pirate, attributes, mass_assignment_options)
# end
- generated_feature_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1
+ generated_methods_module.module_eval <<-eoruby, __FILE__, __LINE__ + 1
if method_defined?(:#{association_name}_attributes=)
remove_method(:#{association_name}_attributes=)
end

0 comments on commit 628a89e

Please sign in to comment.