Forum: Ruby on Rails Scaffold skip "xxx_id" column in table?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
00dcbece2b58b70630eede8b2aed6911?d=identicon&s=25 anakintang (Guest)
on 2007-05-03 07:18
All,

I have a schema which contains two columns called "category_id" and
"data_id", and "category" and "data" are two other different tables in
the same database. When I use "Scaffold" to generate the view and
controller I found that in "_form.rhtml" there are no input field for
"category_id" and "data_id". It seems like scaffold skipped them for
some reason.

Is it what it is suppose to be?

Thanks,
Yingqi
317aad7f9f0b69a440faca74bbe22b20?d=identicon&s=25 Jakob Skjerning (Guest)
on 2007-05-05 11:56
(Received via mailing list)
On May 3, 2007, at 07:18 , anakintang wrote:

> I have a schema which contains two columns called "category_id" and
> "data_id", and "category" and "data" are two other different tables in
> the same database. When I use "Scaffold" to generate the view and
> controller I found that in "_form.rhtml" there are no input field for
> "category_id" and "data_id". It seems like scaffold skipped them for
> some reason.

Yup, which is fairly obvious if you look at the actually generated
code and look up the content_columns method <http://
api.rubyonrails.org/classes/ActiveRecord/Base.html#M001020>.

--
Jakob Skjerning - http://mentalized.net
This topic is locked and can not be replied to.