Charanya Nagarajan wrote:

>  <%= collection_select(:category, :id, @categories, :id, :name, 
> {},{:size=>10}) %>
> will have the value of @category selected
> so you can set the default value to @category and then use the 
> collection select.
> 
> This was the method I used as I had to make different categories as 
> default selected one for different users.There might be some better ways 
> too.Eager to know them too.

Thanks for your response.

>> <%= f.collection_select :brand, ['Brand 1', 'Brand 2', 'Brand 3', 'Brand 
>> 4'], :to_s, :to_s %>

The above is the syntax I'm currently using. In theory, the default 
brand would be Brand 1, correct? So when a form containing this 
collection gets submitted (without amending the collection), Brand 1 is 
parsed as the one selected. At least, that's what I'm looking for.
-- 
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