I’m trying to create link in title of post that opens new page with this post.
I tried <%= link_to post.title, posts_path(path) %>, but getting error
undefined local variable or method `posts_path' for #<#<Class:0x007fbf134f2b88>:0x007fbf13c17d78>
What am i doing wrong?
rake:routes:
posts_index GET /posts/index(.:format) posts#index
posts_new GET /posts/new(.:format) posts#new
posts_create POST /posts/create(.:format) posts#create
GET /posts/:id(.:format) posts#show
root / home#index
root / home#index
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
users GET /users(.:format) users#index
user GET /users/:id(.:format) users#show
If you just want to go to the show action, it’s enough to write
Which is the same as
Take a look a the doc: http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to