Wednesday, August 1, 2012

[Rails] Re: accepts_nested_attributes_for, validates_associated, and validates_presence_of within a has_many/belongs_to

But wouldn't your suggestion that defeat the purpose of using
accepts_nested_attributes_for - where when someone submits a form with
associations, it saves attributes on associated records through the
parent by calling Parent.create, for example in the controller
responding to the form request

On Aug 1, 10:41 am, Dave Aronson <googlegroups2d...@davearonson.com>
wrote:
> On Wed, Aug 1, 2012 at 12:09 AM, John Merlino <stoici...@aol.com> wrote:
> > this will
> > raise an error, because project_id does not exist yet, since the
> > project has not been saved yet.
>
> Can you create the project first, saving it before you allow the user
> to even try to add tasks?
>
> -Dave
>
> --
>  Dave Aronson, Cleared/Remote Ruby on Rails Freelancer
> (NoVa/DC/Remote); seewww.DaveAronson.com, and blogs atwww.Codosaur.us,www.Dare2XL.com,www.RecruitingRants.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate