I’ve heard scaffolding is bad - is that true?

Posted almost 6 years ago by Gemma Ward
Posted almost 6 years ago by Jason Chen

Actually, you can create controllers and models and all sort of that stuff your own, from scratch. But scaffolding provides all the boiler plate code so it saves time. For real beginners, I don't think scaffolding would be a good fit. But if you've finished the Etsydemo course and has a basic knowledge of what models, controllers, routes do, just go ahead and use scaffold. Trust me, it'll be a lot faster than doing it from scratch.

Posted almost 6 years ago by Alex Yang

You should think of scaffolding as just one of the tools in your Rails toolbox. You can’t rely on a single tool to do everything. A hammer won’t do a good job of drilling a screw into a wall, but it’s great to use on nails. In the same way, using Rails scaffolding in all situations is a bad idea, but using it in specific circumstances can save you time.

I recommend using scaffolding when you need a model, controller, and view pages for a pretty standard resource. For example, it’s great to use for product listings because they require all the standard actions that come by default: index, show, create, edit, etc. In these situations, scaffolding allows you to avoid having to start from scratch.

I suggest not using scaffolding if you need just a controller or if your resource doesn’t need the default actions that Rails provides. In this case, it will be more work having to customize the default scaffolding code and it makes more sense to do it all yourself.