Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does “scaffold” mean in Ruby on Rails?

I am studying a guide in which scaffold is mentioned. I don't understand what it is.

Is it sort of built-in framework?

like image 673
user658213 Avatar asked Apr 25 '11 06:04

user658213


People also ask

What is scaffold Ruby on Rails?

Scaffolding in Ruby on Rails refers to the auto generation of a simple set of a model, views and controller usually for a single table. For example: user@localhost$ ./scripts/generate scaffold users. Would create a full CRUD (create, read, update, delete) web interface for the Users table.

What is scaffold command?

One of the products of the rails generate scaffold command is a database migration. Migrations are Ruby classes that are designed to make it simple to create and modify database tables. Rails uses rake commands to run migrations, and it's possible to undo a migration after it's been applied to your database.

How do I create a scaffold in rails?

To generate a fully working scaffold for a new object, including model, controller, views, assets, and tests, use the rails g scaffold command. Then you can run rake db:migrate to set up the database table. Then you can visit http://localhost:3000/widgets and you'll see a fully functional CRUD scaffold.


2 Answers

see rails guide for the explanation

Rails scaffolding is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.

like image 84
denisjacquemin Avatar answered Sep 22 '22 02:09

denisjacquemin


Scaffolding in Ruby on Rails refers to the auto generation of a simple set of a model, views and controller usually for a single table.

For example:

user@localhost$ ./scripts/generate scaffold users 

Would create a full CRUD (create, read, update, delete) web interface for the Users table. Of course features like hashing the password, uploading images, etc... are not handled and must be added to the auto-generated code.

like image 33
Phillip Whelan Avatar answered Sep 22 '22 02:09

Phillip Whelan