Difference between model and scaffold generators


#1

Hi, among lots other confusions herez one… I found two kinda similar
(:to me) =>
script/generate model business name:string address:string
location_id:integer
AND
script/generate scaffold business name:string address:string
location_id:integer

but with model I couldn’t do this:
http://localhost:port-number/businesses

but with scaffold this url came with the option to give input which is
saved in the database.

So, I don’t use model but scaffold. So, can someone plz lighten me up on
this. thnx…


#2

On Oct 5, 4:01 pm, Jay P. removed_email_address@domain.invalid
wrote:

but with scaffold this url came with the option to give input which is
saved in the database.

So, I don’t use model but scaffold. So, can someone plz lighten me up on
this. thnx…

model just genenates the model. Scaffold generates a controller and
views too.

Fred


#3

On Sun, 2008-10-05 at 08:48 -0700, Frederick C. wrote:

location_id:integer
views too.


correct me if I’m wrong but I thought…

script/generate model SOME_MODEL

would also generate a migration script too

Craig


#4

Matt H. wrote:

“./script/generate model mymodelname” creates an activerecord model that
is usually linked to a database but doesn’t have to be.

“./script/generate scaffold scaffoldname” creates a model, a controller,
a layout, some css styles etc. This gives you the model plus everything
else you would need to play with it.

This doesn’t mean that scaffolding should be used all the time, it is
good for quick development but it isn’t customisable enough and isn’t
supposed to be used in a production environment.

Hope this helps

Matt

thnx guys…


#5

Jay P. wrote:

but with scaffold this url came with the option to give input which is
saved in the database.

So, I don’t use model but scaffold. So, can someone plz lighten me up on
this. thnx…

“./script/generate model mymodelname” creates an activerecord model that
is usually linked to a database but doesn’t have to be.

“./script/generate scaffold scaffoldname” creates a model, a controller,
a layout, some css styles etc. This gives you the model plus everything
else you would need to play with it.

This doesn’t mean that scaffolding should be used all the time, it is
good for quick development but it isn’t customisable enough and isn’t
supposed to be used in a production environment.

Hope this helps

Matt