Hi,
I have a number of models that have various states specific to the domain. I was wondering how people go about modelling and persisting this state and optionally track its progress.
I notice in DHH's resources on rails speech he included the following code snippet,
class Kase < ActiveRecord::Base has_one :progress end
class Progress < ActiveRecord::Base belongs_to :kase belongs_to :initiator, :class_name => "Person" end
class Opened < Progress end
class Reviewed < Progress belongs_to :verifier, :class_name => "Person" end
class Closed < Progress end
As someone still learning Ruby, what would be the best way to interrogate a Kase object progress? Is it down to testing for the kaseobject.progress type?
I had also considered you would have a Kase model with separate attributes for opened, reviewed, and closed. Each Progress object containing the time and preserving stage information between progress states.
Such as myKase.reviewed? => nil or Reviewed object
Do they above couple of points sound reasonable or have I misinterpreted what is suggested.
Thanks, Andrew