ActiveRecord :: Dirty does not work in Rails 3.2.16

Am I trying to get the .attribute_changed part? functionality from ActiveRecord :: Dirty

I followed the example here: http://api.rubyonrails.org/v3.2.16/classes/ActiveModel/Dirty.html

but i got:

ArgumentError (wrong number of arguments (3 for 0)):
  app/models/appointment.rb:5:in `<class:Appointment>'

because of this line:

define_attribute_methods [:at, :job_type, :length]

so I tried NonPersistedAttributeMethods: https://stackoverflow.com/a/2108639/ ...

but override methods do not work ('at' returns nil if it is not.

what I have:

def at
  @at
end
def at=(val)
  at_will_change! unless val == @at
  @at = val
end
+3
source share

All Articles