Jim Neath's walkthru (http://jimneath.org/2008/09/06/multi-model-forms-
validations-in-ruby-on-rails/) talks about validating multiple objects
before saving.  His example is below:

if @person.valid? & @cat.valid? & @dog.valid?
  Person.transaction do
    @person.save!
    @cat.save!
    @dog.save!
  end
else
  FAIL
end

I am trying to do something similar but in my situation there may not
always be a @cat or @dog (there will always be a @person though).
Does anyone know of a way that I can run the same validation but allow
for the conditional presence of the 2 objects?

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