I'm fairly new to RoR and I think I don't get some of the ActiveRecord
# a lookup table (used to show countries in a <select>)
class Country < ActiveRecord::Base
# a table of companies (each located in a specific country).
class Breeder < ActiveRecord::Base
validates_associated :country # may be NIL when we don't know it yet
Currently, I do in the controller to create or update a Breeder:
country_id = p[:country_id]
@breeder = Breeder.new(p)
@breeder.country = country_id.blank? ? nil :
What exactly is the difference for @breeder.country when it's assigned
a (found) Country or breeder.country_id is set by
Both save the country_id to the "breeders" table; besides that, the
Breeder "knows" that the country_id (may) refer to a country and could
do the find above itself.