# Basic Doubts

**URL:** <https://www.ruby-forum.com/t/basic-doubts/166785>\
**Category:** Rails\
**Created:** [April 29, 2009, 4:14pm UTC](https://www.ruby-forum.com/t/basic-doubts/166785 "2009-04-29T16:14:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartolome](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bcef8e/32.png) [@bartolome](https://www.ruby-forum.com/u/bartolome)\
**Post date:** [April 29, 2009, 4:14pm UTC](https://www.ruby-forum.com/t/basic-doubts/166785/1 "2009-04-29T16:14:16Z")

</div>

I’ve just started a project and I’ve been having some basic doubts.  
Firstly,  
I created my db schema using a db modeling tool. Then I generated the  
tables  
according to that model. After I created the schema.rb. The database.yml  
is  
ok and also the first migration. My doubt is: when I run  
_script/generate  
scaffold Post_ for example, it creates my view without any field, even  
if  
all the tables are created and my migration before scaffolding has the  
correct definition to the Post table. Instead of using the current  
migration, the scaffold command creates a new one. Is there any way to  
run  
scaffold and do not create a new migration without fields? I wouldn’t  
like  
to write down the schema of each table every time I wanted to use  
scaffold.

Second doubt: Can I run _script/generate model Post_ without create a  
new  
migration or write down the fields definition? I’d like to use what is  
on  
the database and on the current migration (the whole schema)

Thanks in advance

–  
_Rodrigo F._  
Web D.  
SCJP

---

<div class="post-metadata">

**Author:** ![bartolome](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bcef8e/32.png) [@bartolome](https://www.ruby-forum.com/u/bartolome)\
**Post date:** [April 29, 2009, 4:45pm UTC](https://www.ruby-forum.com/t/basic-doubts/166785/2 "2009-04-29T16:45:29Z")

</div>

On Apr 29, 2009, at 8:25 AM, Rodrigo F. wrote:

> wouldn’t like to write down the schema of each table every time I  
> wanted to use scaffold.

You probably want to either:

1. Move beyond using the scaffold and roll your own code once you  
understand what’s going on
2. START with the scaffold as a place to begin and let it create the  
initial migration, model, controller, etc.

> Second doubt: Can I run script/generate model Post without create a  
> new migration or write down the fields definition? I’d like to use  
> what is on the database and on the current migration (the whole  
> schema)

You can run just:  
script/generate model  
to get help on the generator (or just script/generate to see what  
generators are available)

You want the --skip-migration option. You can also just create your  
own model file (and test or spec file to go along with it).

> Thanks in advance
> 
> –  
> Rodrigo F.  
> Web D.  
> SCJP

You’re Welcome,  
-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid
