lib/active_resource/associations.rb in embark-journey-0.1.6 vs lib/active_resource/associations.rb in embark-journey-0.1.7
- old
+ new
@@ -124,11 +124,11 @@
instance_variable_set(ivar_name, nil)
remove_method(method_name)
end
define_method(method_name) do
- if ivar = instance_variable_get(ivar_name)
- ivar
+ if instance_variable_defined?(ivar_name)
+ instance_variable_get(ivar_name)
elsif attributes.include?(method_name)
attributes[method_name]
elsif association_id = send(finder_key)
return nil if association_id.blank?
instance_variable_set(ivar_name, (association_model.find(association_id) rescue nil))