Please, make sure that the object in your form_for helper:
1. object.response_to? "type_id"
2. object.type_id == 2
--
Thanks, Ivan Povalyukhin

On Dec 21, 11:37 pm, Alfredo Bonilla <[email protected]> wrote:
> Hi,
>
> in my controller, for an edit action, I'm getting the whole list of
> values from a table with types:
>
> @cm_board_types = CmBoardType.find(:all, :conditions => ['project_id=?',
> @project.id])
>
> My problem is that when I display an existing record (to edit it) with
> the type_id field: the select displayed does not have the html
> "selected" clause, so this combo always shows the first value in the
> recovered list (@cm_board_types)... I've lot of similar cases working
> perfectly, but this... I can not find where is the problem.
>
> Instead of showing this:
> <option value="1">Type Name for Value 1</option>
> <option selected="selected" value="2">Type Name for Value 2</option>
>
> is showing this:
> <option value="1">Type Name for Value 1</option>
> <option value="2">Type Name for Value 2</option>
>
> About the form:
> <p><%= f.select :type_id, (@cm_board_types.collect {|p| [p.name,
> p.id]}), :required => true %></p>
>
> Thanks in advance
>
> --
> Posted viahttp://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