browner than u wrote:
hey thanks for the reply. i tried what you suggested. here is the
code:
<%= link_to "Results", :action => "index", :id => "current", :class =>
"northcrest" %>
and here is the resulting html:
<a href="/plugincompare/index/current?class=northcrest">Results</a>
my first post was a little off. this is what i'm looking for as a
result. same concept:
<a href="/plugincompare/index" id="current"
class=northcrest">Results</a>
Check out the docs for link_to
http://caboo.se/doc/classes/ActionView/Helpers/UrlHelper.html#M006132
Mainly:
link_to(name, options = {}, html_options = nil)
Now in this littl method, name is what appears for you to click on,
options is actually an object which can generate a url, and html_options
is a hash of attribute/value pairs added to the resulting html tag.
So when you do:
link_to "Results",
:action => "index",
:id => "current",
:class => "northcrest"
Ruby thinks it is:
link_to("Results",
{:action => "index",
:id => "current",
:class => "northcrest"})
All those options are getting wrapped up in the hash that is used to
generate the url. You want to pass some of those into the html_options
argument.
link_to('Results', {:action => 'index},
{:id => 'current', :class => 'northcrest})
This nested brace syntax can be a bit cumbersome. This is one of the
many reasons people often used named routes instead.
#routes.rb
map.results 'results', :controller => 'results'
#view
link_to 'Results', results_path, :id => 'current', :class =>
'northcrest'
The results_path fills the url portions of the arguments, and the hash
you then pass in falls into the "html_options" argument, providing the
functionality you want.