[Ror-es] sub-resources salen al reves
alarkspur
Sun Jan 13 13:20:26 GMT 2008
- Previous message: [Ror-es] URGENTE: Busco programador para realizar plugin de una app
- Next message: [Ror-es] sub-resources salen al reves
-
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hola
seguro que es una tontería que se me ha paso algo, pero por mas que le
doy vueltas no doy con la solución :-(
dos modelos Authors y Books
routes.rb
map.resources :authors, :has_many => [ :books ]
routes
edit_author_book GET /authors/:author_id/books/:id/edit
{ :controller=>"books", :action=>"edit" }
author_book DELETE /authors/:author_id/books/:id
{ :controller=>"books", :action=>"show" }
Hasta aquí todo correcto, pero al hacer en la vista show de Authors
algo como
%ul
- @author.books.each do |c|
%li= c.title
%li= link_to 'editar', edit_author_book_path( c )
%li= link_to 'eliminar', author_book_path( c ), :method
=> :delete, :confirm => 'Seguro?'
me genera los ids al reves, suponiendo que author tiene el id 28 y
libro el id 1, me generaría
/authors/:id/books/:author_id/edit
/authors/:id/books/:author_id
/authors/1/books/28/edit
/authors/1/books/28
teniendo que ser las correctas así ¿no?
/authors/28/books/1/edit
/authors/28/books/1
Que raro no? se les ocurre a que puede ser debido esto?
Muchas gracias por la ayuda.
Un saludo.
- Previous message: [Ror-es] URGENTE: Busco programador para realizar plugin de una app
- Next message: [Ror-es] sub-resources salen al reves
-
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]