F
F
FreezkoSS2017-09-24 23:00:53
Ruby on Rails
FreezkoSS, 2017-09-24 23:00:53

How to make a link to an element that has a specific id?

There is a Posts database, the post variable is created in the control, post_path is the path to display all the emails, but how can I output them with a specific id using link_to?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
romanwb, 2017-09-28
@romanwb

@post = Post.find(params[:id])
link_to "Title", post_path(@post)

or
link_to "Title", @post

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question