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
0
votes
0 answers

Symfony link_to popup on the layout doesnt work

I have a layout base page. On this page I have a link_to to open up a popup:
CE_REAL
  • 384
  • 5
  • 13
0
votes
1 answer

How to make a link with many elements in rails using haml

I am very new in ruby, in rails and in haml. I was recoding a little site I have, and I was trying to create a link in wich is nested a few elements. The structure I want to be outputted is this one:
pzin
  • 4,200
  • 2
  • 28
  • 49
0
votes
1 answer

Array after link_to - rails file upload model

I upload documents and then on my admin home page I display all the documents like so: <% @document.each do |document|%>

<%= link_to document.name, document.contract_url.to_s%>

<%end%> In my user's home page I render the documents that…
Benamir
  • 1,107
  • 2
  • 11
  • 24
0
votes
1 answer

Can I use an edit path with conditional for ruby on rails link_to?

I wan to create a link_to tag with a conditional for example: The below code probably doesn't work... do not try link_to "Edit postal address", edit_postal_address_path( :condition => {:organization_id => @organization_id } ) I want to edit the…
Jakcst
  • 605
  • 3
  • 8
  • 16
0
votes
3 answers

link_to has no controller and no action

I have a view with the following link generator: - @tags.each do |tag| = link_to tag.name, :controller => "images", :action => "#{tag.name}" @tags is Tag.all. It displays the links with the correct names, mouseover shows…
user929062
  • 807
  • 4
  • 12
  • 33
0
votes
2 answers

link_to :controller, :action in view not working ruby on rails

Trying to use link_to to send info to action in my controller. Link looks like this: <%= link_to "Buy", {:controller => :policies, :action => :policy_option_price_calc, :option => "policy_option_a_cost" }, {:method => :post} %> I have a policies…
Ryan
  • 5,644
  • 3
  • 38
  • 66
0
votes
2 answers

link_to gives an error

In my index.html.erb

<%= link_to "log Out", :action => 'logout' %>

In home controller.rb def logout end and gives me error Routing Error No route matches {:action=>"logout", :controller=>"home"} this maybe simple question. I'm new to…
Darshana
  • 2,462
  • 6
  • 28
  • 54
0
votes
2 answers

How to make restful link_to

I need to generate link like tasks/new/1 but my link_to generates link like <%= link_to "", {:controller => "tasks", :action => "new", :pid => project.id } %> tasks/new?pid=1 What i need to do?
user1625602
  • 63
  • 1
  • 6
0
votes
3 answers

Using link_to in Rails 3 on the end of a string

There is probably a really simple answer to this but, as I'm a Rails newbie, I'm having great difficulty identifying the appropriate syntax. Basically, I want to display a string with a link on the end, in which "Jimmy" here represents both the…
Graeme
  • 481
  • 6
  • 20
0
votes
2 answers

Rails - how can I create an ajax link for row highlighting

I have a great example of instant row hilighting that I want to do: http://www.mrc-productivity.com/techblog/?p=684 How can I create a Turn on row highlights link with rails. I have tried many combination of link_to and…
junky
  • 1,480
  • 1
  • 17
  • 32
0
votes
1 answer

Rails Ajax Div Disappearing

I have an app where I'm trying to do an Ajax link_to with :remote to refresh some divs. When I click on the button "En route" it updates the status div but makes the times div disappear. Here is my code: index.html.erb

MDT Interface

nulltek
  • 3,247
  • 9
  • 44
  • 94
0
votes
2 answers

link_to is not working with a variable url

I have a view that uses link_to to pass parameters to a controller. The url is a variable. Something is not working. I'd appreciate any clues. Thanks! <% url1 = dialogs_path(@dialogId) %> <%= url1 %> <%= link_to "Go!", url1(:uid1 => @uid1, :uid2 =>…
user1388066
  • 97
  • 2
  • 9
0
votes
1 answer

Rails link_to action with URL parameters

If I have a route like so get 'controller/:id/action/:param' => 'Controller#action' How can I use link_to to create a link like ? So far I have gotten link_to 'Link text', {:action => 'action'} To give me
arcyqwerty
  • 10,325
  • 4
  • 47
  • 84
0
votes
1 answer

Rails 3 increment the value of my counter with link_to

Good morning, In my Ruby On Rails application I am trying to build a stat counter for wins and for losses. These stats are displayed in the sidebar of my page, which is always visible. For these values i use a model named Stats. The stats should be…
dhartwich
  • 398
  • 2
  • 6
  • 16
0
votes
2 answers

How to work with ajax when showing different partials - Rails 3

So I was wondering how to work with the link_to method and ajax in Rails 3, when redering different partials. Example: Let say I have two link in show.html.erb and every link have a partial to render.
  • <%= link_to "Group1", user_path(@user),…
  • user592638