Sorry, for the confusion :)
I meant that the object, you are passing to the form_for (in your case
it is @cm_board) should have the attribute "type_id" and the value
stored in that attribute should be equal to the index of the option
you want to have selected.
Here is the short note from the documentation:
"
select(object, method, choices, options = {}, html_options = {})
Create a select tag and a series of contained option tags for the
provided object and method. The option currently held by the object
will be selected, provided that the object is available. See
options_for_select for the required format of the choices parameter.
Example with @post.person_id => 1:
  select("post", "person_id", Person.all.collect {|p| [ p.name,
p.id ] }, { :include_blank => true })
could become:
  <select name="post[person_id]">
    <option value=""></option>
    <option value="1" selected="selected">David</option>
    <option value="2">Sam</option>
    <option value="3">Tobias</option>
  </select>

This can be used to provide a default set of options in the standard
way: before rendering the create form, a new model instance is
assigned the default options and bound to @model_name. Usually this
model is not saved to the database. Instead, a second model object is
created when the create request is received. This allows the user to
submit a form page more than once with the expected results of
creating multiple records. In addition, this allows a single partial
to be used to generate form inputs for both edit and create forms.
By default, post.person_id is the selected option. Specify :selected
=> value to use a different selection or :selected => nil to leave all
options unselected. Similarly, you can specify values to be disabled
in the option tags by specifying the :disabled option. This can either
be a single value or an array of values to be disabled."
--
Thanks, Ivan Povalyukhin

On Dec 22, 7:53 am, Alfredo Bonilla <[email protected]> wrote:
> Thanks for your answer. But, I don't know exactly what you mean.
>
> First is renderized the edit.rhtml form. From this one:
> ...
> <%= render :partial => 'edit' %>
> ...
>
> The partial _edit.rhtml form:
> <% labelled_tabular_form_for :cm_board, @cm_board,
>          :url => {:action => 'edit', :id => @cm_board},
>          :html => {:id => 'edit-cm_board-form',
>                    :class => nil,
>                    :multipart => true} do |f| %>
> ...
>
> and finally the _attributes.rhtml form:
> <% fields_for :cm_board, @cm_board, :builder => TabularFormBuilder do
> |f| %>
> ...
>
> The labelled_tabular_form_for helper looks like:
> def labelled_tabular_form_for(name, object, options, &proc)
>   options[:html] ||= {}
>   options[:html][:class] = 'tabular' unless
> options[:html].has_key?(:class)
>   form_for(name, object, options.merge({ :builder => TabularFormBuilder,
> :lang => current_language}), &proc)
> end
>
> where can I search for the info you request?
>
> --
> 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