ordinarily you''d just do /parents/new and pass along a child attribute
values in params[ :child => {...} ]
On Jul 11, 12:40 pm, Wes Gamble
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I have a couple of resources, one nested in the other, such that my
> resource spec in routes.rb is:
>
> map.resources :parents, :has_many => :children
>
> This will generate a route for a new child that assumes that the parent
> has already been saved, something like:
>
> /parents/:parent_id/children/new
>
> But what if I want a route that handles the case where the parent
> resource is also new, and thus does not have an id? One that would
> generate a URL that would look like:
>
> /parents/new/children/new
>
> to handle cases where I am composing a new parent by creating many
> children so that I can save everything at once?
>
> Has anyone done this? Seems like I could do it two ways:
>
> 1) Write my own completely custom route
> 2) Explicitly write the route for /parents/:parent_id/children/new and
> just set the default value for :parent_id to "new" and make it go
to the
> same place?
>
> This is definitely an outgrowth of my resistance against saving stuff to
> the database before I absolutely have to, but I thought I would float it
> and see what people thought?
>
> Thanks,
> Wes
> --
> Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---