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

Rails 3, browser back functionality

I am trying to get a back feature working on a Iphone web application. I have looked at all the other posts about this issue, but none of them address my specific case. This is my sequence of actions; home page -> event page (click of a person…
zacropetricopus
  • 407
  • 1
  • 5
  • 12
3
votes
2 answers

Clean way in Rails to conditionally change the link_to location

SO i have this link_to
  • <%= link_to "Home", root_path %>
  • but if its an admin i want go to a different location like below...I know i can do this but is there a cleaner way <% if admin_user %>
  • <%= link_to "Home",…
  • Matt Elhotiby
    • 43,028
    • 85
    • 218
    • 321
    3
    votes
    2 answers

    I'm trying to implement `link_to` in a flash message for an update action in a controller in Rails but I cannot get it to render to the browser

    I have a controller like this in my project: class BriefcasesController < ApplicationController ... def update @super_power = SuperPower.find(params[:super_power_id]) @briefcase.contents.delete(params[:super_power_id].to_s) …
    3
    votes
    1 answer

    undefined method 'to_model' when linking thumbnail to original image

    I'm creating an album that I'm planning to display with Masonry and ImgZoom so that the visitors can have a bigger image when they click on it. According to ImgZoom, to make the zoom work, you need to do the following:
    Jaeger
    • 1,686
    • 1
    • 30
    • 50
    3
    votes
    3 answers

    named routes with devise in Rails 3 haml view

    from rake routes I get this in my application new_admin_session GET /admins/sign_in(.:format) {:controller=>"devise/sessions", :action=>"new"} admin_session POST …
    bradgonesurfing
    • 30,949
    • 17
    • 114
    • 217
    3
    votes
    2 answers

    Add extra data in ajax:beforeSend (link_to)?

    I have a link_to with remote: set to true. What I want to do is add an extra attribute with the request so I tried it with this: