Ralph Shnelvar wrote:
> Lasse Bunk wrote:
>> f.label :something, "something"
>> 
>> :-) Lasse
>> 
>> 2010/2/14 Ralph Shnelvar <[email protected]>
> 
> Well ... that certainly was simple .... but then what is the purpose of 
> the first parameter?  What are the downsides to
>   f.label '',  "something"
> ?

OK ... I sniffed around on the 'net to try to answer my own question.

Apparently the first field becomes the target of the
  for=
HTML parameter.  The "for=" field, in turn, becomes associated with 
another html tag's (e.g. an input tag.)

So

- - - - -
<label for="xyzzy">Whatever</label>
Put anything here
<input type="checkbox" id="xyzzy" value="check me" />
- - - -

associates the label with the input.  Thus
(from ActionView::Helpers::FormTagHelper) documentation
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M001606

label(:post, :title)
  # => <label for="post_title">Title</label>

now makes sense to me.  One now has a css tag to play with.

Thank you,  Lasse Bunk.  Sometimes the most trivial of answers helps the 
most.
-- 
Posted via http://www.ruby-forum.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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to