Questions tagged [link-to]

link_to is the method in Ruby on Rails that is used to create link tags within views.

link_to is the method in Ruby on Rails that is used to create link tags within views.

e.g., With the appropriate route defined and the profile object with ID=1,

link_to "Profile", @profile

would return the HTML fragment

<a href="/profiles/1">Profile</a>

More details can be found in the Ruby on Rails API documentation.

863 questions
-2
votes
1 answer

Probably the Bootstrap framework is causing the "Friends" nav-item to not appear correctly

I am new in Bootstrap and using Bootstrap 4 with Bootstrap 5 code mixed. I am trying to display the Friends and About Us links in the navbar, but they don't even appear The code is
-2
votes
1 answer

link_to redirecting to "SHOW' method instead of "DELETE"

= link_to multimedium_path(f), method: :delete, data: { confirm: 'Are you sure to delete this multimedia?' } do i.fa.fa-trash.fa-lg.mr-2.text-danger When i use link_to, the button is redirecting me to show method of the multimedia…
Sheriff Hussain
  • 224
  • 2
  • 12
-2
votes
3 answers

adding params to a path defined by a string - rails

I have the following link that passes parameters to the url, and it works fine. <%= link_to "Buy", new_buyer_path(plan: 'item_D78387628dd', cost:'$45.00'), class: "btn btn-pink", role: "button" %> However, I have a second link that takes its path…
-2
votes
1 answer

how to save links in a database and display them

i am working on a rails blog app, and i need to add user tags on post. example i write and post the following; 'my dogs name is john. #dogs' i want dogs to be clickable text on that post. how do i display a clickable #dogs text on view to a route…
alphons
  • 67
  • 5
-2
votes
1 answer

haml Ruby on Rails, add link into table

I'm trying to add a link into my table, group.link holds a URL and I want to make this into a clickable link. This is what I've tried to do so far but it isn't correct: - @groups.each do |group| %tr %td= group.name %td= group.description …
ChatNoir
  • 415
  • 8
  • 18
-3
votes
1 answer

Rails 4 - Form of expression for a link

I'm trying to make an app in Rails 4. I have a profile model, and an organisation model. Organisation has an attribute called 'title'. Associations are: Profile belongs_to organisation Organisations has_many profiles I'm trying to figure out how…
Mel
  • 2,481
  • 26
  • 113
  • 273
-4
votes
3 answers

Ruby on Rails - how to add link to view through button

i have the below code, and i just want to link my button to the next view how can i fix this
user6118473
  • 13
  • 2
  • 6
-4
votes
1 answer

Can't understand where link_to points to

I'm trying to understand an app in which it creates a link via link_to to new_user_session_path. In my controller, there is no new nor session. The generate link is users/sign_in which you can see here : [ListenUp][1]. Also, sign_in is not in the…
MusicAndCode
  • 870
  • 8
  • 22
1 2 3
57
58