Hi I have a scaffold CRUD app going and have managed to get my foreign
key to populate a select dropdown list in the edit/new _form.rhtml
It seemed logical to have a foreign key with a select list.
Unfortunately, I can't figure out how to get the content of that same
foreign key to appear in show or list actions.
My tables are:
In the artworks table there is a column named category_id and it
belongs_to :category, :foreign_key => 'category_name'
In the categories table there is a column named category_name
Any tips or help here? Do I need to do something in my category.rb or
artwork.rb models? or in my admin_controller.rb controller?
The default scaffold template show.rhtml uses:
for columns in Artwork.content_columns
(I'm assuming this is the same as:
Artwork.content_columns.each do |column| ... end )
I checked out the content_columns method in the API and says that it
strips out an array item that ends with _id but that seems to be the
logical choice for a foreign key!
So, if I change the schema to use a different name for the foreign
key, will it work? Or am I way lost. (I feel lost)
Please be gentle and verbose!