Forum: Ruby on Rails Get fields in a generator

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ccf0f43fe1adcaf0992e9576f0eb4494?d=identicon&s=25 Marcelo Junior (mr_brownstone)
on 2007-01-10 23:53
I am making a generator, and I want make a partial form with all columns
the of table. How made for get count of columns, and how made for get
each columns, and also to show the name of column?
3a76b084177a80d0be65fec1dab83234?d=identicon&s=25 nolifetillpleather (Guest)
on 2007-01-11 00:07
(Received via mailing list)
You can just say:

YourModel.content_columns each do |c|

Ccf0f43fe1adcaf0992e9576f0eb4494?d=identicon&s=25 Marcelo Junior (mr_brownstone)
on 2007-01-11 00:22
nolifetillpleather wrote:
> You can just say:
> YourModel.content_columns each do |c|
> ...
> end

But I not have a MyModel, my model will created with the generator. How
I make in a generator?
This topic is locked and can not be replied to.