Help with ruby=>html

Hi!

I’m new to ruby and rails and got problems with using basic methods like
form_tag or link_to etc to create what i need, i.e. to specify css class
or id or name of html elements.

I have problem with understanding rails api (it’s just as an example):
form_tag(url_for_options = {}, options = {}, *parameters_for_url)

what parameters can i pass to form_tag? How to specify class, name or id
(those are things i need most)?

If someone could clarify the notation used here i’d be very grateful.

g0nzo wrote:

I’m new to ruby and rails and got problems with using basic methods like
form_tag or link_to etc to create what i need, i.e. to specify css class
or id or name of html elements.

I have problem with understanding rails api (it’s just as an example):
form_tag(url_for_options = {}, options = {}, *parameters_for_url)

what parameters can i pass to form_tag? How to specify class, name or id
(those are things i need most)?

Most of the tag helper methods (form_tag and link_to included) take an
options or html_options hash that is used for specifying tag attributes,
e.g:

<%= form_tag({:controller => ‘my_controller’, :action => ‘my_action’},
‘class’ => ‘my_class’, ‘id’ => ‘my_id’) %>

<%= link_to(‘link’, {:action => ‘my_action’},
‘class’ => ‘my_class’, ‘id’ => ‘my_id’) %>


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby