Okay, this is something I run into a lot and don't really have a great
solution.  Here is a simple example:

class Blog < ActiveRecord::Base
  has_many :posts
  validates_presence_of   :name
end

class Post < ActiveRecord::Base
  belongs_to :blog
  validates_presence_of  :name
  validates_presence_of  :blog_id
end

Now, if I want to create a blog and post at the same time I don't want
either to be created if one of them fails.  So imagine that I have a
new valid blog, but a post with no name.  I do not want the blog to be
created because the post failed validation.

Thanks,
Tom
--~--~---------~--~----~------------~-------~--~----~
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