How do you reconcile foreign keys for forms?

Hi all,

I’m looking to resolve foreign keys for forms – similar to the way
“streamlined” does it. Although the actual value stored in an object
is the foreign key integer, I’d like the actual name of the item

I’m sure it’s easy. Thoughts?


So you have one object, say a user
and another one that belongs to the user, say an address

User model:

has_one :address

Address model

belongs_to :user

then after finding the user
@user = User.find(params[:id])

you can access the address with
or single address fields

belongs_to and has_many have a lot of options.
You can set a foreign_key if you don’t use the default user_id in the
address table