I''m looking at some of these form helpers in the API and see where you put html options in, however I don''t see any examples. I know this is probably a lame question but can anyone point me to some examples. How the options are written out perhaps ? TIA Stuart --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
HTML options are just as it sounds, the options put on the request string. So url_for :controller => ''cont'', :action => ''action'', :id => 1, :my_option => ''option'' will give you (depending on routes, of course): ''/cont/action?id=1&my_option=option'' In short, any key,value pair given after the keys expected by options{} gets turned into URL string options. If that doesn''t answer your question, could you post an example of where you''re confused? Thanks. Jason On 8/28/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I''m looking at some of these form helpers in the API and see where you > put html options in, however I don''t see any examples. I know this is > probably a lame question but can anyone point me to some examples. > How the options are written out perhaps ? > > > TIA > Stuart > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m going to asume you''re new to Ruby, please ignore if you aren''t. As Jason pointed out, it''s just a hash like any other.. but make sure you don''t fall into this trap: link_to "Here", :controller => ''foo'', :action => ''bar'', :class => ''some_class'' Here ''class'' is the HTML attribute you''re wanting to assign to the A tag. That attribute will never see the light of day however. Ruby has some great time saving shortcuts, but if you don''t know they''re there they can also cause you problems. Ruby assumes all the arguments after "Here" are all one hash, you need to let Ruby that isn''t case so that it''ll take notice of your class attribute: link_to "Here", { :controller => ''foo'', :action => ''bar'' }, { :class => ''some_class'' } So when you see that an argument accepts HTML options, just remember the defined your hash boundaries. Hope that helps. Ian On 28/08/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I''m looking at some of these form helpers in the API and see where you > put html options in, however I don''t see any examples. I know this is > probably a lame question but can anyone point me to some examples. > How the options are written out perhaps ? > > > TIA > Stuart > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Actually, the link_to, button_to, and url_for I understood. I was looking at "selects" and didn''t understand the HTML options part. Perhaps I''m just confusing myself needlessly and they work the same. Stuart On 8/28/06, Ian Leitch <port001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m going to asume you''re new to Ruby, please ignore if you aren''t. > > As Jason pointed out, it''s just a hash like any other.. but make sure you > don''t fall into this trap: > > link_to "Here", :controller => ''foo'', :action => ''bar'', :class => > ''some_class'' > > Here ''class'' is the HTML attribute you''re wanting to assign to the A tag. > That attribute will never see the light of day however. Ruby has some great > time saving shortcuts, but if you don''t know they''re there they can also > cause you problems. > Ruby assumes all the arguments after "Here" are all one hash, you need to > let Ruby that isn''t case so that it''ll take notice of your class attribute: > > link_to "Here", { :controller => ''foo'', :action => ''bar'' }, { :class => > ''some_class'' } > > So when you see that an argument accepts HTML options, just remember the > defined your hash boundaries. > > Hope that helps. > Ian > > > On 28/08/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''m looking at some of these form helpers in the API and see where you > > put html options in, however I don''t see any examples. I know this is > > probably a lame question but can anyone point me to some examples. > > How the options are written out perhaps ? > > > > > > TIA > > Stuart > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Aug 28, 2006, at 2:54 PM, Dark Ambient wrote:> Actually, the link_to, button_to, and url_for I understood. I was > looking at "selects" and didn''t understand the HTML options part. > Perhaps I''m just confusing myself needlessly and they work the same.I think that''s a lack of adherence to naming conventions. (Or a lack of naming conventions?) It seems that the ''options'' parameter to the check_box helper method does what the ''html_options'' parameter to the select helper method does (and the select helper method has its own ''options'' parameter). Am I misreading it? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---