Rails 2.3.5
For a “link_to” tag, I’m trying to pin down the syntax for sending extra parameters and specifying a class. I’m using the jQuery UI library to change links into buttons with a class of ‘link_button’.
This sends the extra ‘min_max’ parameter, but the class will not be applied:
<%= link_to "CLICK HERE", :action => 'edit', :id => @threshold_control.id, :min_max => 'different', :class => 'link_button' %>
This is not sending the extra ‘min_max’ parameter, but the ‘link_button’ class is applied:
<%= link_to 'CLICK HERE',edit_threshold_control_path(@threshold_control.id), :min_max => 'different', :class => 'link_button' %>
I haven’t seen a specific example of extra link_to parameters AND a class specified, and none of my guesses at the syntax needed for both things to work at the same time have worked. Thanks for any help.
Try:
link_toexpects two hashes after the name of the link. If you don’t use curly braces there is no way to know when the first hash ends and the second hash starts.