ruby - rails default actions are missing params in routing -
excuse me lame question, i`m stuck. plain , simple in routes.rb file have:
resource :books resource :reviews end
running rake routes | grep reviews gives me:
books_reviews post /books/reviews(.:format) reviews#create new_books_reviews /books/reviews/new(.:format) reviews#new edit_books_reviews /books/reviews/edit(.:format) reviews#edit /books/reviews(.:format) reviews#show put /books/reviews(.:format) reviews#update delete /books/reviews(.:format) reviews#destroy
my question is: :id param in show , edit actions? according tutorial: http://guides.rubyonrails.org/routing.html there should "id" params in routing, this:
new_books_reviews /books/:id/reviews/new(.:format) reviews#new edit_books_reviews /books/:id/reviews/edit(.:format) reviews#edit /books/:id/reviews(.:format) reviews#show
on top of routes show, update , destroy actions? think i`m missing fundamental, because sucks. running rails 3.2.11 help
try using resources instead of resource. rails thinks there's 1 when use singular form , doesn't need id.
for more info see "singular resource" section of guide
Comments
Post a Comment