0

I have a link_to helper that I'd love to use Twitter's Bootstrap.js to provide a popover. I have the following code:

"access", :action => "login" %>

I need to add the following HTML attributes: data-placement="" and rel="".

How do I do this using link_to? I've tried different variations of this:

<%= link_to "Login", 'data-placement' => 'below', :controller => "access", :action => "login" %>

<%= link_to "Login", html_options = {'data-placement' => 'below'}, :controller => "access", :action => "login" %>

<%= link_to "Login", :data => {'placement' => 'below'}, :controller => "access", :action => "login" %>

All these do is append things to my URL so it becomes:

http://localhost:3000/access/login?data-placement=below

I'm sure I've done this before!

-Jim

1 Answer 1

4

Apparently when using this format, I needed to specify the controller and action in a hash.

<%= link_to "Login", {:controller => "access", :action => "login"}, 'data-placement' => 'below' %>
Sign up to request clarification or add additional context in comments.

1 Comment

<%= link_to "Login", {:controller => "access", :action => "login"}, :data => {'placement' => 'below'} %>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.