I have a model that needs to update a property whenever another property
changes, i.e. changing the model ‘type’ property updates the
‘description’ property with another value.
I don’t know how to get access to the underlying fields handled by rails
within a model class.
Hello Daniel,
It sounds like you are looking for the magic that makes the Observer
design pattern happen. In Ruby this is done using the Observable module.
Example code here ;
FYI, I have NOT tried this under rails, but, I would be intrigued to
hear how you get along with it. Let us all know how it goes
Regards
Stef
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.