Olá pessoal,
em um projeto aqui to tentando fazer um slug de forma que a url fique
assim:
http://localhost:3000/pages/main/fragments/title
mas o máximo que consegui foi deixar assim:
http://localhost:3000/pages/main/fragments/1
na url, main e title sao os slugs do registro que tenho para um objeto
do tipo page.. o codigo ta no link
http://gist.github.com/227334
problema é que não to conseguindo fazer o segundo slug (para
fragments) da forma como ta o primeiro (page). Se deixar do mesmo
jeito aparece o seguinte erro
ActionController::RoutingError in Pages#show
page_fragment_url failed to generate from
{:controller=>"fragments", :page_id=>#<Page id: 1, title: "Página
principal", slug: "main", created_at: "2009-11-05 19:44:55",
updated_at: "2009-11-05 19:44:55">, :id=>#<Fragment id: 1,
fragmentable_id: 1, fragmentable_type: "Page", title: "title", slug:
nil, body: "teste", created_at: "2009-11-05 19:48:53", updated_at:
"2009-11-05 19:48:53">, :action=>"show"}, expected:
{:controller=>"fragments", :action=>"show"}, diff: {:page_id=>#<Page
id: 1, title: "Página principal", slug: "main", created_at:
"2009-11-05 19:44:55", updated_at: "2009-11-05
19:44:55">, :id=>#<Fragment id: 1, fragmentable_id: 1,
fragmentable_type: "Page", title: "title", slug: nil, body: "teste",
created_at: "2009-11-05 19:48:53", updated_at: "2009-11-05 19:48:53">}
alguém tem alguma idéia ?????