I've managed to do it the old way using /books/new?author_id=
and
@author = Author.find(params[:author_id])
@book = @author.books.new
as you've suggested.
thanks again.
On 9 oct, 02:48, robertderosny <[EMAIL PROTECTED]> wrote:
> thanks for your help
>
> /authors/3/books/new gives me a
>
> Routing Error
> No route matches "/authors/3/books/new" with {:method=>:get}
>
> I guess i need to update my routes.rb for this to work ?
>
> i've tried this :
>
> map.resources :books, :path_prefix => "/authors/:author_id"
>
> without success ..
>
> if that helps : i'm using rails 2 with REST.
>
> On 8 oct, 19:26, Freddy Andersen <[EMAIL PROTECTED]> wrote:
>
> > Two ways the good and the bad :
>
> > Good:
>
> > url:
> > /author/1/book/new
>
> > BookController
> > new
> > @author = Author.find(params[:author_id])
> > @book = @author.books.new
>
> > or (not so good)
>
> > BookController
>
> > @author = Author.find(params[:author])
> > @book = Book.new
> > @book.author = @author
>
> > Should work too...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---