开发者

_path is generating the wrong path

I don't know why, but it is generating the path with a . instead of /

if I use link_to 'Destroy', @serie

it generates /series.1

so I had to use this: link_to 'Destroy', series_path + "/" + @serie.id.to_s

In order to get /series/1

but this is a problem to submit, I would have to override it everywhere Any ideas of what I've done wrong?

my routes file:

`Newepisode::Application.routes.draw do

resource :users

resource :series

resources :series

resource :episodes

resources :episodes

resource :user_serie

match "login" => "users#login"

match "logout" 开发者_JAVA技巧=> 'users#logout'

match "signin" => "users#signin"

post "users/do_login"

match "series/load_other_series" => "user_serie#load_other_series"

get "admin" => "admin#index"

match 'user/:alias' => 'series#load_user_series'

match 'feed/:alias' => 'user_serie#feed'

root :to => 'series#main'

end`


This is your problem:

resource :series    
resources :series

It should be

resource :serie

or

resources :series

[Edit]

The same stuff with :episodes...

[Edit]

This is basic stuff... you're getting this link: /series.1 becouse with this line

resource :series

you are telling rails that there is only one row in series objects, so the id of the object is irrelevant. You should remove this line and leave only

resources :series

and don't forget to restart server after that

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜