Hi,
I have
<%= link_to ‘Add a New Prescription’, :controller => ‘forms’, :action
=> ‘new’, :class => “sidebar2Text” %>
which is producing
How do I make the “class” its own attribute?
Thanks, - Dave
Hi,
I have
<%= link_to ‘Add a New Prescription’, :controller => ‘forms’, :action
=> ‘new’, :class => “sidebar2Text” %>
which is producing
How do I make the “class” its own attribute?
Thanks, - Dave
[email protected] wrote:
Hi,
I have
<%= link_to ‘Add a New Prescription’, :controller => ‘forms’, :action
=> ‘new’, :class => “sidebar2Text” %>which is producing
How do I make the “class” its own attribute?
Thanks, - Dave
Dave,
Since the options hash can include any extra variables as query
parameters, you need to make sure that link_to realizes you’ve moved
from the options hash to the html_options hash… you just need to wrap
the regular options in {} like this:
<%= link_to ‘Add a New Prescription’, {:controller => ‘forms’, :action
=> ‘new’}, :cass => ‘sidebar2Text’ %>
Try this:
<%= link_to ‘Add a New Prescription’, {:controller => ‘forms’,
:action=> ‘new’}, :class => “sidebar2Text” %>
The link_to method receives 3 parameters, with your call, you were
providing just two (the hash was counting as the 2nd one), the 3th
parameter is the options hash, were you should put the HTML class.
On Thu, Sep 4, 2008 at 12:39 AM, [email protected]
[email protected] wrote:
How do I make the “class” its own attribute?
Thanks, - Dave
–
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)
João Pessoa, PB, +55 83 8867-7208
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs