Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In the Ruby on Rails tutorial, I read something that suggested that experienced developers do not use scaffolding since they tend to like to just write the code to connect the MVC on their own.

In a different place I read that it is a good idea to use scaffolding because it helps you stick to convention so others who look at and interact with your code will understand what you are doing.

I am pretty new to Ruby on Rails but not MVC or web application - should I generally try hard to stick to scaffolding conventions and let it guide me?

share|improve this question
1  
I put in an edit submission to change Ruby in the title to Ruby on Rails, if thats okay. –  alternative May 9 '11 at 21:34
    
@mathepic Yup, makes more sense now - thanks for doing that. –  Genadinik May 9 '11 at 21:59

7 Answers 7

up vote 17 down vote accepted

Scaffolding serves a purpose - it's a rapid prototyping tool. Use it if that is what you are doing. Once you have your prototype, you can intelligently make the decision to modify what the scaffolding produced for you, or delete the scaffolding and build up the app exactly as you want it.

If this is your first rails application, I strongly recommend however that you don't use scaffolding. As a learning exercise, nothing teaches better than getting down to the metal and seeing exactly what you need to get an app up and running.

Hope this helps!

share|improve this answer
    
It helps and I see your point. The application IS meant for others to use though, so I am just trying to get enough background so I can get most things architected right on my own. –  Genadinik May 9 '11 at 23:12

I've never used it in 4 years of building Rails apps. It can be useful in some situations I suppose. The nice thing about it is that it's an obvious temporary UI, so no one will try to go live with it.

The same cannot be said about ActiveScaffold (in case you come across it). It looks like a shippable UI, and management might be fooled into thinking that the UI is good to go and ask you to ship. Don't! In fact, I'm already regretting I mentioned AS.

share|improve this answer

I use it, for the simple reason that it's quicker to delete unneeded code from what the scaffold generates than to create all the files and code manually.

If I were you I would at least try it for yourself and see if what it puts out is mostly useful or not.

share|improve this answer

To echo what others have said, when I use Rails I use scaffolding but I don't rely on scaffolding, if that makes sense. Often I need 90% of what the scaffold generates, so it's easier to run the generator and then remove what I don't need (e.g. the "HTML or XML" stuff if I don't need XML) than to write all of the same code by hand. You don't do anything but waste keystrokes.

If you're learning, then you should write it by hand so you know what it does and why it does it, and then later on start using the scaffolding to quickly generate that code. IMO a professional Rails developer knows when to use scaffolding, and when to use it to generate some basic code and then modify it as needed for the app at hand.

share|improve this answer

I developed many websites with RoR and in the company I worked we never used it. I think that is true for most RoR developers. Though I remember a few discussions about this and some professional developers where using it in some circumstances.

But I think they didn't use the default version of Rails scaffolding, implementing their own variation instead. This may work especially well if you do in house work for large companies, where the design doesn't change a lot (or doesn't matter) and you need a lot of views on the same kind of data for statistics or similar repetitive tasks.

share|improve this answer

I started my app with scaffolding, but by the third entity when I started to deviate from the "RoR way", I found it useless.

share|improve this answer

In short: no.

I'll use generators but I almost never use scaffolds anymore. You tend to spend a fair bit of time editing the scaffolds and it gets a bit unweilding.

I find a good compromise to use the controller generators can get you up and running pretty quick if you are doing top-down development.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.