Can anyone give me an example of using html_options with
link_to_remote? I''d like to set (for instance) the CSS Class on the
resulting link. I''ve tried this sort of thing:
<%= link_to_remote ''Text'', :url => {:action =>
''myaction'', :id =>
myobject.id}, :html_options => {:class => ''myclass''}
%>
Everything works OK except that it ignores the HTML options.
Thanks,
Cliffe
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
cliffeh wrote:> Can anyone give me an example of using html_options with > link_to_remote? I''d like to set (for instance) the CSS Class on the > resulting link. I''ve tried this sort of thing: > > <%= link_to_remote ''Text'', :url => {:action => ''myaction'', :id => > myobject.id}, :html_options => {:class => ''myclass''} %> > >drop the :html_options => part... eg. <%= link_to_remote ''Text'', :url => {:action => ''myaction'', :id => myobject.id}, :class => ''myclass'' %> I think that should work... G> Everything works OK except that it ignores the HTML options. > > Thanks, > Cliffe > > > > > > >-- about me: My greatest achievement was when all the other kids just learnt to count from 1 to 10, i was counting (0..9) - gustav.paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> Can anyone give me an example of using html_options with > link_to_remote? I''d like to set (for instance) the CSS Class on the > resulting link. I''ve tried this sort of thing: > > <%= link_to_remote ''Text'', :url => {:action => ''myaction'', :id => > myobject.id}, :html_options => {:class => ''myclass''} %>In your case Rails cannot tell where does options parameter hash end and html_options hash begins. Try that: <%= link_to_remote ''Text'', {:url => {:action => ''myaction'', :id => myobject.id}}, {:class => ''myclass''} %> Regards, Rimantas -- http://rimantas.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> drop the :html_options => part... > eg. > > <%= link_to_remote ''Text'', :url => {:action => ''myaction'', :id => myobject.id}, :class => ''myclass'' %>> I think that should work...You are right about :html_options, but this still will not work, because ''options'' hash will swallow both :url and :class leaving ''html_options'' empty. When using html_options, make sure Rails can tell them from options, i.e. use curly braces for options: <%= link_to_remote ''Text'', {:url => {:action => ''myaction'', :id => myobject.id}}, :class => ''myclass'' %> Regards, Rimantas -- http://rimantas.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---