Ruby select helpers

Hi

Can anyone tell me when i should be using the different select helpers

select(object, method, collection, options = {}, html_options = {})

select_tag(name, option_tags = nil, options = {})

collection_select(object, method, collection, value_method, text_method,
options = {}, html_options = {})

Is that all of them? I understand the advantages of using
collection_select over the others, as it allows me to pass in a hash,
but other than that, the whole thing confuses me.

Thanks

Pingu P. wrote:

Can anyone tell me when i should be using the different select helpers

select(object, method, collection, options = {}, html_options = {})

select_tag(name, option_tags = nil, options = {})

Use the first when @object is an instance of an Active Record model.
It automatically sets a suitable name attribute for posted parameters,
and also automatically selects the current value of @object.method.

Use the second for full custom control over the name and selected value.


We develop, watch us RoR, in numbers too big to ignore.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs