New To Rails

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

Walter Davis wrote in post #1077557:

I have now ran into another issue.

I have a field like this on my _form.html page:

<%= f.collection_select :address_region, Admin::Region.order(:region), :id, :region, :include_blank => true %>

This works fine, but if I don't select a value (which is okay) I can not later edit the record. If I try to, I get:

Couldn't find Admin::Region without an ID

Is there anyway to edit the form if users have left the field blank?