Re: [Rails] New To Rails
On Sep 25, 2012, at 6:44 PM, DONEIN NET wrote:
> I am new to Ruby On Rails.
>
> I have scaffolded a few screens for a website's administration pages.
>
> For example, right now I have (etc., etc.):
>
> admin/companies
> admin/regions
> admin/countries
>
> 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
--
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