lib/surrounded/context.rb in surrounded-0.9.7 vs lib/surrounded/context.rb in surrounded-0.9.8

- old
+ new

@@ -133,11 +133,11 @@ def role_map @role_map ||= role_mapper_class.new end def map_roles(role_object_array) - role_object_array.each do |role, object| + role_object_array.to_a.each do |role, object| if self.respond_to?("map_role_#{role}") self.send("map_role_#{role}", object) else map_role(role, role_behavior_name(role), object) map_role_collection(role, role_behavior_name(role), object) @@ -207,10 +207,12 @@ end def apply_behaviors role_map.each do |role, mod_name, object| player = apply_behavior(role, mod_name, object) - player.__send__(:store_context) do; end + if player.respond_to?(:store_context, true) + player.__send__(:store_context) do; end + end end end def remove_behaviors role_map.each do |role, mod_name, player| \ No newline at end of file