Scaffolding in Ruby on Rails


Ruby on Rails is the new Web development programming Language. It seems very good. Even I am new to it and I am learning it from Wrox and Agile Ebook. ROR is the programming language which consists of parts as Model, Controllers, Views, Actions.
Recently I was trying a Example given in the book. It consists of a scaffold method which is to be used in a controller which has syntax as:
class AdminController < ApplicationController
scaffold :product
end

here ‘admin’ is the controller used and product is the model which is to be created and database is ‘products’

This is dynamic scaffold method. But googling on internet and ruby forums I got to know that in Rails2.0 static scaffold method is no more used. Only dynamic method is used.

So just go into the rails application folder and type the following command for the above scaffold, So here it becomes static scaffold:

ruby script/generate scaffold product title:string description:text image_url:string

So here model is ‘product’ and table named ‘products’ is created with the parameters and columns as written after product in above command.
I will put a detailed post with all commands and step wise explaination.
But Important is if you get the Agile Web development with ROR 3rd edition(Beta will also do) it has correct steps to be followed, but in Wrox and Agile 2nd edition the steps are explained using dynamic scaffold method.

Advertisements

One thought on “Scaffolding in Ruby on Rails

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s