I'm getting an error when posting thru google; this is 3rd time, 
sorry...

On Oct 22, 2:40 pm, Evan <[EMAIL PROTECTED]> wrote:
> I did not notice that warning about validates_presence_of before.
> Thanks for bringing it to my attention. Your thought process helped me
> understand better what is going on.

Take a look at a more recent post from Mark R J:
http://www.ruby-forum.com/topic/168650
He shows how you can use validates_presence_of with assocations when 
building a new object.
ie
  u.books.build(:title => 'The Comedy of Errors', :author => u)
where u is an unsaved User object (used as an author).  I can't remember 
your example exactly, but that might work for you with your current 
validations.  The way the (online) docs are worded, though, suggests 
that the AR-people intended it to be used more for foreign key fields 
than the associations based on them.
The callback before_destroy I mentioned was just a thought about how you 
might stop an olive oil source from being 'destroyed' ('delete' won't 
invoke callbacks) if it happens to be the only source for an olive oil 
object.  Anyway, you have a bunch of validations and callbacks to use to 
achieve whatever you need to do.

--
Daniel Bush
-- 
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to