AppleII717 wrote:
> I have nested models:
> 
> Assessments has_many Questions has_many Answers.
> 
> I have plans on turning this into an engine where it can be used by
> other models.
> 
> There are several fields in both Questions and Answers that, if
> changed (or created ,deleted) I need to call a "update_procedure" that
> does some calculations and saves the results in the Assessment.
> 
> Right now I have an after_save and after_destroy filter that calls the
> routine if anything is changed, which is not what I want. What
> approach do I need to handle filters if only certain attributes are
> change?. The reason is that I may need to change the state/status of
> the assessment if scores in another model were based on the current
> version. I don't need to do the state change if the admin just fixed a
> misspelling.
> 
> I looked at Module: ActiveRecord::Dirty, but not sure I understand it.
> Is that what I need to understand?

A quick look at the rdoc would suggest that Dirty#changed would do what 
you want.  An observer might be useful too.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to