# Rails 3 generate model

**URL:** <https://www.ruby-forum.com/t/rails-3-generate-model/196058>\
**Category:** Rails\
**Created:** [October 6, 2010, 8:19am UTC](https://www.ruby-forum.com/t/rails-3-generate-model/196058 "2010-10-06T08:19:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![halv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e95f7d/32.png) [@halv](https://www.ruby-forum.com/u/halv)\
**Post date:** [October 6, 2010, 8:19am UTC](https://www.ruby-forum.com/t/rails-3-generate-model/196058/1 "2010-10-06T08:19:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![halv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e95f7d/32.png) [@halv](https://www.ruby-forum.com/u/halv)\
**Post date:** [October 6, 2010, 8:21am UTC](https://www.ruby-forum.com/t/rails-3-generate-model/196058/2 "2010-10-06T08:21:07Z")

</div>

On Oct 5, 10:25 pm, hal [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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
