Scaffold skip "xxx_id" column in table?


#1

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


#2

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