On Saturday 16 May 2009, Branko Vukelic wrote:
> I decided to remove the
>
>     validates_presence_of :nutrient_id, :ingredient_id
>
> from the Nutrition's validation. And this works.To make sure I can't
> save a blank _id field, I'll add :allow_null => false to references
> columns. (I didn't do it before because I didn't know it was
> possible :P ).

Yes, probably your best bet in cases like this is to ensure consistency 
at the database level (you should do this anyway) and wrap a transaction 
block around the database manipulations. It may help to create/update 
objects piecemeal instead of trying to build a graph of objects and save 
them with a single object.save.

Michael

-- 
Michael Schuerig
mailto:mich...@schuerig.de
http://www.schuerig.de/michael/


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

Reply via email to