Thanks so much for taking the time to consider this Fred.

I got it working, thanks to some patient help from several complete
strangers. The generosity inside online communities is a wonderful
thing.

I had to add both duration_minutes and duration_hours to the model so
the callback could access them. I had initially been thinking of them
as just "disposable" items, not worth saving. Now I'm glad I did
because, to answer your question, yes we are just as likely to change
the duration of an assignment as we are to change its start time. Lots
of little last minute changes in our shop.
:(
Once those attributes became available to the model, I could write a
before_save callback like this:

def create_end
  self.ends_at = starts_at.advance(:hours => duration_hours, :minutes
=> duration_minutes)
  end

So thanks again for your help. I learned some interesting things. Not
having worked with model callback methods before, I had not grasped
that the params method was not available to models. Thanks for that
insight.

Steve
--~--~---------~--~----~------------~-------~--~----~
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