Question

I am new to rails framework. I am confused that what is the benefit of generating scaffold instead of creating tables and columns in DB manually.What is the best for creating rich relational databases in Rails? And can I do bit advance things using scaffold i.e: changing the name of table and column after creating it. Restricting some fields to be private (scaffold should not generate a field in view for that particular private field)

Please explain this to me as I know very little about it! Thanks in advance.

Was it helpful?

Solution

The purpose of scaffolding is to get some boilerplate code quickly. By typing one small command you get model, migrations, views, controller and what not. Now you can tweak the views, for example (or migrations or anything else). Or leave them be if it's some prototype. At least, you didn't have to spend 4 hours creating everything by hand.

Imagine that you start a new blog application. You'll need posts, comments, users, categories. Without scaffolding this is easily a day of work. With scaffolding - two minutes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top