Skip to content

Commit

Permalink
Change implementation create setter methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnipe committed Apr 14, 2015
1 parent e379085 commit 583e46a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/lotus/entity/dirty_tracking.rb
Expand Up @@ -44,10 +44,12 @@ module ClassMethods
# @api private
def define_attr_accessor(attr)
attr_reader(attr)
define_method "#{attr}=" do |val|
_attribute_changed(attr) if val != __send__(attr)
instance_variable_set("@#{attr}", val)
end
class_eval %{
def #{ attr }=(value)
_attribute_changed(:#{ attr }) if value != @#{ attr }
@#{ attr } = value
end
}
end
end

Expand Down

0 comments on commit 583e46a

Please sign in to comment.