B
B
bismoney2015-11-05 21:11:12
Ruby on Rails
bismoney, 2015-11-05 21:11:12

Routing change?

Hello friends.
I'm trying to make the post links look like this
/news/eda/kak_est_edy.html
I have a very hard time with English
Categories with posts are linked by post_id
In routes.rb I'm trying to create a path
get 'news/:cat_seo_url/:id', to: 'posts #show', as: 'news_show'
Where cat_seo_url is the url that is specified when creating the category.
In post_controller in show I enter
def show
@post=Post.find_cat_seo_url!(params[:id])
end
On the end I get
No route matches missing required keys: [:id]
Tell me what I'm doing wrong?
How to give him an ID?

Answer the question

In order to leave comments, you need to log in

1 answer(s)

just leaving it here https://github.com/norman/friendly_id
also what you are trying to do is stackoverflow.com/questions/12353088/route-for-sho...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question