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.
anakintang (Guest)
on 2007-05-03 09: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
Jakob S. (Guest)
on 2007-05-05 13: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 S. - http://mentalized.net
This topic is locked and can not be replied to.