link-to Questions

9

I need to add a link to download the file from assets/docs/Физика.pdf I do not know how to do that. I am trying to do so here: in view - <%= link_to "download", '/Физика.pdf', :download => ...
Rile asked 21/8, 2016 at 23:53

13

Solved

I wanted to add confirmation message on link_to function with Ruby. = link_to 'Reset message', :action=>'reset' ,:confirm=>'Are you sure?' Any ideas why it's not working?

13

Solved

Basically, I have a lot of code that looks like this: link_to t('.profile'), business_path(@business), class: '#{'active' if current_page? business_path(@business)}' which isn't very DRY. I was...
Adolescence asked 5/9, 2013 at 16:59

7

Solved

I just started coding in ruby on rails and I've been following a guide which is using a more outdated version of rails than I am using. I am using 3.2.12 This is my code: <%= button_to 'Destro...
Dilator asked 3/4, 2013 at 23:34

4

Solved

I know this is probably a pretty simple concept. I am trying to create a link to a controller and action. For example I have a link in my layout file to update a record when a link is clicked, so I...
Photocurrent asked 9/4, 2011 at 19:2

3

Solved

I want a link to update a resource, without using an HTML form. Routes: resources :users do resources :friends end Rake routes: user_friend GET /users/:user_id/friends/:id(.:format){:action...
Shouse asked 20/1, 2011 at 19:53

5

Solved

<%= link_to ((image_tag 'image.png'), url_for({:controller => 'controller_name', :action => 'action_name'}), :class => 'quick', :remote => true) %> This part of code will g...
Soapwort asked 14/9, 2011 at 10:31

6

Solved

I have a link that I need to submit a post request with. Normally, I'd use jQuery and prevent the link's default behavior and then submit a form to the destination. This seems like something Rails ...

10

Solved

I am trying to delete a post using the code below: <%= link_to 'Destroy', post, :method => :delete, :onclick => "return confirm('Are you sure you want to delete this post?')" %> whic...
Hermelindahermeneutic asked 21/10, 2012 at 10:52

3

Solved

I'm trying to use the button_to rails helper. I wrote the following code: <%= button_to 'Edit Item', edit_item_path(@item), :class => 'mark-button' %> and got the following error messag...
Overman asked 16/1, 2011 at 22:55

6

Solved

I have a list of values in url/title pairs that I'd like to display. (More specifically, each object has its own list of links, some with 0, some with 1, some with more.) I would like them to appea...
Bobker asked 10/7, 2013 at 1:29

8

I have the following link_to delete url in my app <%=link_to "Delete",blog_path(@blog.id), :method => :delete, :class => "delete", :confirm => "Are you sure ?"%> It does not seem...
Waldman asked 12/12, 2010 at 18:45

2

Solved

In the code below, I'm trying to make it so that, if a user has accepted an invite, they'll be able to click on the "not attending" div to decline the invite. That bit of logic works fine, but I'm...
Fidgety asked 27/6, 2012 at 19:23

3

Solved

I'm new to Rails, and I'm trying to use the link_to helper to create a link that issues a PUT request instead of a GET request. Specifically, I'm trying to create a link that activates a user's acc...
Depressive asked 16/2, 2012 at 4:54

2

Solved

How can I use the link_to method in Rails 4 to provide the same effect as <a href="(mysite.example.com)" class="tooltips" data-toggle="tooltip" data-placement="top" title="" data-original-tit...
Echelon asked 3/4, 2015 at 16:25

6

Solved

I would like to give visitors the option to download some pdf. I have tried: <%= link_to "abc", "/data/abc.pdf"%> <%= link_to "abc", "/data/abc.pdf", :format => 'pdf' %> and som...
Caucus asked 31/10, 2012 at 18:4

3

Solved

I want to call a javascript function that will be conditional upon a user's response to the confirm box. For example, I have the following anchor: <%= link_to 'Sign Out', destroy_session_path,...

4

Solved

I'm experiencing some unusual behaviour with my Rails 4 Application. Every single-time I click on a link_to inside my views, my controllers actions are being called twice. For example: In my root_...
Prithee asked 25/11, 2013 at 22:50

8

I must change a link_to tag color without using a CSS class, how can I do? I've tried something such as <%= link_to item.description, {}, {:style=>'color:#FFFFFF;', :class => "css_class"}...
Definition asked 19/3, 2012 at 10:25

2

Solved

I have a link_to on my rails4 page which uses slim syntax. The following link_to link_to exports_path, data: { confirm: "Are you sure?" } is now required to only show the confirm message upon a ...
Scraperboard asked 10/12, 2013 at 23:21

1

I have a link where I need to pass a sequence of params, where 2 params are always nill. link_to go_to_action_path(id, par_01, par_02, par_03, par_04) In some cases are the par_01 and par_02 nil...
Baecher asked 20/5, 2018 at 15:5

5

Solved

I have a link_to Rails helper that downloads a wallpaper when clicked. But the image is loading in the browser instead of being downloaded immediately. <%= link_to "1920x1080", @download.wallpa...
Cosmism asked 20/7, 2011 at 2:41

5

Solved

Is there a simple and straightforward way to provide a link in a view to either create a resource if it doesn't exist or edit the existing on if it does? IE: User has_one :profile Currently I w...
Antiphonary asked 11/4, 2011 at 17:50

7

Solved

On my site a user has a personal profile with a link to his personal external website. The url of the sites I store in a postgresql database under the name website. When I test the result, I always...
Ancier asked 23/5, 2013 at 18:57

4

Solved

I'm using link_to in RoR 3 When I use it like this, it works fine: <%= link_to "Add to your favorites list",:controller => 'favourite_companies', :action =>'create', :company_id=>...
Saviour asked 18/4, 2011 at 0:43

© 2022 - 2025 — McMap. All rights reserved.