Rails 3 generate model

Hello,
I would like to generate a model through my rails 3 application.
Eg I can type:
rails g model Abc
at the command line.

I want to do the same through my application.

I have done it before with an earlier version of rails eg :

Rails::Generator::Scripts::Generate.new.run([‘model’,@name])

but I am not sure of the command in Rails 3, and the ‘require’
statements to ensure I won’t get any ‘no such file errors’.

There is plenty of documentation on how to create a generator but not
the more basic step of how to run the existing ones,

thanks in advance,
Hal

On Oct 5, 10:25 pm, hal [email protected] wrote:

I have done it before with an earlier version of rails eg :

Rails::Generator::Scripts::Generate.new.run([‘model’,@name])

but I am not sure of the command in Rails 3, and the ‘require’
statements to ensure I won’t get any ‘no such file errors’.

There is plenty of documentation on how to create a generator but not
the more basic step of how to run the existing ones,

I don’t know exactly how generators have changed but I’m curious - why
would you want your app to be running generators on itself at
runtime ?

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs