Permalink
Browse files

Fix for edge rails by defining a *_attributes= method for each associ…

…ation declared with :attributes => true
  • Loading branch information...
1 parent b0c493a commit 1bc67e29f9adfca630e329a4ea8d7735602c3fc9 @bkeepers bkeepers committed Sep 27, 2008
Showing with 12 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +10 −0 lib/attribute_fu/associations.rb
View
@@ -1 +1,2 @@
-.DS_Store
+.DS_Store
+test/debug.log
@@ -114,10 +114,20 @@ def has_many_with_association_option(association_id, options = {}, &extension)
discard_if = discard_if.to_proc if discard_if.is_a?(Symbol)
managed_association_attributes[association_id][:discard_if] = discard_if
end
+ collection_with_attributes_writer(association_id)
end
has_many_without_association_option(association_id, options, &extension)
end
+
+ private
+
+ def collection_with_attributes_writer(association_name)
+ define_method("#{association_name.to_s.singularize}_attributes=") do |attributes|
+ has_many_attributes association_name, attributes
+ end
+ end
+
end
end # Associations

0 comments on commit 1bc67e2

Please sign in to comment.