John John wrote:
Is there any reason that foreign key fields do not show in any of the
scaffold views ?
id serial primary key,
foreign key (category_id) references categories(id),
foreign key (user_id) references users(id)
scaffold generated views only show name, morestuff fields
From what I read, scaffold causes rails to hide anything named id or
ending with _id.
If you want, say, dropdown menus from lookup tables ( I needed these.
Took a long time to figure out how to do ) try this:
<%= options_from_collection_for_select(Yourmodel.find(:all, :order =>
“id”), :id, :lookupField, selected_value= someIDhere) %>
someIDhere in my cases was the foreign key field in the parent table.
This allowed me to get it to select the right entry for that record.
options_from_collection_for_select is in the rails API. You’ll be
spending a LOT of time sifting through that if you plan to stick it out
in rails. Good luck.