I'm trying to get some of the .attribute_changed? 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/14467907/203915
but the override methods aren't working ('at' returns nil when it isn't)
what I've got:
def at
@at
end
def at=(val)
at_will_change! unless val == @at
@at = val
end