Hello, I just started learning RoR myself, and I have a few newbie questions. (1) Is it always necessary to use the "script/generate" to start an app? Can it be created from scratch if one wanted to? (Not that I would, but I'm trying to understand...) (2) I followed the rails getting started guide to create a blog successfully. Then I thought of adding a login/authentication mechanism, and proceeded to run the "script/generate login" (after getting login_generator.zip) on the same rail app. It messed up the original blog, because it had file name conflicts (I think). How would I run multiple "script/generate" on an app without messing up the app? Thanks! Kumi
on 2009-04-13 22:39
on 2009-04-14 12:02
1) It is definitely not necessary to use "script/generate" but it can be very helpful when you're just starting out. The variants on generate (run "script/generate --help" and check out the installed generators) can give you a good idea on how the different MVC components hang together. 2) Yes, well there seems to be a growing dissatisfaction with plugins that rely on generate to build your app. My guess is that your experience is part of the reason. Configuration management (svn or git) can be invaluable here. You really want to be able to back out the recent damage on occasion. As far as running multiple generates you need to understand what's going on with the different generators, i.e.: generate model User name:string profile:text generate scaffold User name:string profile:text both create a user.rb model and migration but scaffold also builds the controller and views as well as adding routes. You need to understand what is created when you issue the generate command and the best way I've found is to run it and study the results.
on 2009-04-14 17:24
Thanks very much for this clarification. You're right, I'm usually coding things myself and not used to the concept of having things generated for me. I do have git, so I was able to back out. It sounds like the best way for me is to learn what a lot of plugins do when generated, and combine those myself without using the generate. Just what you suggested.. :-) Thanks!!
on 2009-04-14 19:34
Glad I could help.