[Rails] Re: New To Rails
Walter Davis wrote in post #1077557:
> On Sep 25, 2012, at 6:44 PM, DONEIN NET wrote:
>
>> I am going back and editing the scaffolded screens.
>>
>> I need to know how to add a dropdown list to the
>> admin\regions\_form.html.erb page that would show the countries I have
>> added using admin/countries/new.
>
> If your region belongs_to country, then you could do something like this
> (inside a form_for for the region):
>
> <%= f.collection_select :country_id, Country.order(:name), :id, :name %>
>
> Walter
Thanks! That got me going in the right direction. The one tricky part
was that my items are in the admin folder, so this ended up being the
format:
<%= f.collection_select :country,
Admin::Country.order(:sort_order,:country), :id, :country %>
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home