Permalink
Browse files

* polymorphic_attacher: if false is passed to the attacher, remove th…

…e collection
  • Loading branch information...
1 parent af09681 commit ae435b679a7659514186c0c377b8a13f5e5531fe @ozataman committed Aug 31, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/polymorphic_attacher.rb
@@ -82,7 +82,9 @@ def attach_polymorphic_to(key, val)
find_scope = self.class.read_inheritable_attribute(:polymorphic_attachers)[attacher_key][:find_scope]
- if val.nil? || val.blank?
+ if val == false
+ instance_variable_set(key, [])
+ elsif val.blank?
# do nothing
# if val is a string, then it must be in serialized record form
@@ -150,4 +152,4 @@ def attach_polymorphic_associations
end
-end
+end

0 comments on commit ae435b6

Please sign in to comment.