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
-1
votes
1 answer

Pass params on index_path route

I'm having a helper for displaying the tags of a post # Show action %p Tags #{ link_tags @post } # Helper def link_tags post raw post.tag_list.map{ |t| link_to t, posts_path(tag: t.name) }.join(', ') end However I'm getting an error on…
ltdev
  • 4,037
  • 20
  • 69
  • 129
-1
votes
1 answer

rails link_to - pass hash of values to controller action

I have retrieved some records based on condition in a hash - @special_products. Now I want to pass the hash to a non-restful action(:special)/ of the same controller so that I can view the products. I've tried this but how can link_to pass hash and…
Means
  • 322
  • 2
  • 4
  • 16
-1
votes
1 answer

Facebook share button is not working?

I have a room model and I want to create a share button for facebook. So I decided to do this with the sharer url method. I want to have a facebook icon on the show.html.erb (room view) where a user or visitor can share the room on facebook. When I…
trickydiddy
  • 577
  • 6
  • 26
-1
votes
1 answer

how to pass and receive a parameter using link-to from ember js?

I have on my page a list of clients (only names) and when I click on each one of them, I want to open a new page called 'clientdetails' in which I get the details of the client besides its name (I have an address and an age) ; What I have so far is…
SimpleFuzz
  • 69
  • 9
-1
votes
1 answer

How to list objects on the same page with the same attribute?

How to list on the home page only the challenges with the same categorization if a user clicks on the icon representing that categorization? view <%= link_to categorization_path(categorization: :adventure) do %>
AnthonyGalli.com
  • 2,796
  • 5
  • 31
  • 80
-1
votes
1 answer

Rails: Route Error while trying to update attribute through link_to

ERROR: No route matches [GET] "/bookings/:id/%3E:format" I want to update an attribute when click on link of 'link_to'.. <%= link_to 'Cancel', '/bookings/:id/(.:format)' %> routes.rb put '/bookings/:id/(.:format)' => "bookings#tocancel" patch…
-1
votes
1 answer

link_to doesn't work RubyOnRails

I've two controllers: MainController with pages: index.html.erb LoginController with pages: login.html.erb, signup.html.erb, pasfor.html.erb These are my routes https://gyazo.com/4acf99c74bbb7999d580e32fd1496386 I created <%= link_to '
Laurent S
  • 49
  • 10
-1
votes
1 answer

How to add glyphicons in haml file

I have this .haml file where I want to add glyphincon instead of showing text like I have shown below in the link_to. I have tried to look it up online and it is not working. Can someone help me out? I want the 'Show' and 'Edit' in link_to replaced…
-1
votes
1 answer

How does linking in an html.erb document work?

Listing categories

<% @categories.each do |category| %>
Name Thumburl
<%= category.name…
Peter.Ward
  • 7
  • 1
  • 6
-1
votes
3 answers

Rails 4 embed HTML in link_to

I have the following href code Rails Code <%= link_to "", event_expenses_accept_path(:id => event_expense.id), :method => :post, :class =>…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
-1
votes
2 answers

Pass data safely from view to controller in rails

I want to pass data from a view (link) to a controller so it can look up the related information. Services for a company, in this case. I see examples where people have added to params like this:
<%= link_to 'Services', :controller =>…
vbsql7
  • 684
  • 2
  • 9
  • 17
-1
votes
1 answer

Rails for zombies level 5 video: Why wouldn't tweets_path work?

I have a question about the 5th video 'Routing into darkness'. At about 3 minutes 44 seconds Greg is describing how to set up a link_to using a custom route. A line appears saying "tweets_path wouldn't work". I'd like to know WHY tweets_path…
moosefetcher
  • 1,841
  • 2
  • 23
  • 39
-1
votes
1 answer

Link_to Parameter to send form

I have one page that list sub agents lists, if the user press link_to link, it will send to another page which is form, so user can create money transactions for sub agent the problem is I have to refresh page that have form before the user can…
widjajayd
  • 6,090
  • 4
  • 30
  • 41
-1
votes
2 answers

Rails 4: link_to image_tag with text - how to apply CSS to the text?

I have the following code on my app: <%= link_to (image_tag (attraction.image_url), id: "thumb_size2") + attraction.name, attraction_path(attraction) do %><%end%> It results on a hyperlinked image formatted according to properties set in…
user291
  • 99
  • 1
  • 12
-1
votes
2 answers

Rails link_to working wierd

I have set up a link_to in a partial (update_dashboard) and it looks like this link_to "Link", hash, {:url => {:controller => "results", :action => "update_report"}}, :remote => true 'hash' is a set of inputs that I am passing to the…
vrp1609
  • 61
  • 1
  • 9
1 2 3
57
58