I'm sure I can whip something up to do this, but I'm wondering an elegant solution already exists. I will have any number of Registration objects coming in through web form, but I wish there to be only one User object per unique email address. So far this works fine. So Registration belongs_to User, User has_many Registrations. (This, by the way, is because the site does not have a persistent profile/logged in session and thus the same person could fill out the registration form multiple times.)
What I'd like is if a person comes in a second time, creates a Registration object using an email address that already has an associated User, then update the User.updated_at field. In other words, the clean/dirty status of User is based on the most recent Registration object that was added. Does such a feature already exist in the association? I figure I could get around it altogether by defining User.updated_at as the max of registrations.updated_at, but that's pretty inefficient. My other option is just to put in some sort of before_save filter on Registration. But it seems better placed on User - but User isn't technically changing during this operation, right? So I'm not sure where I'd hook in. -- 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---