Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

a fix for edge rails + active_record_session_storage

  • Loading branch information...
commit 221caf2396151b992d810b7b7bd7477cd52d9459 1 parent d2e6530
Andrzej Krzywda authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 lib/attribute_fu/associations.rb
View
16 lib/attribute_fu/associations.rb
@@ -60,13 +60,15 @@ def has_many_attributes(association_id, attributes) #:nodoc:
end
def save_managed_associations #:nodoc:
- managed_association_attributes.keys.each do |association_id|
- association = send(association_id)
- association.each(&:save)
-
- unless (objects_to_remove = instance_variable_get removal_variable_name(association_id)).nil?
- objects_to_remove.each { |remove_id| association.delete association.detect { |obj| obj.id.to_s == remove_id.to_s } }
- instance_variable_set removal_variable_name(association_id), nil
+ if managed_association_attributes != nil
+ managed_association_attributes.keys.each do |association_id|
+ association = send(association_id)
+ association.each(&:save)
+
+ unless (objects_to_remove = instance_variable_get removal_variable_name(association_id)).nil?
+ objects_to_remove.each { |remove_id| association.delete association.detect { |obj| obj.id.to_s == remove_id.to_s } }
+ instance_variable_set removal_variable_name(association_id), nil
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.