Forum: Ruby on Rails Newbie Question about script/generate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aca693e4cba5faa97725aef2c6dcfa58?d=identicon&s=25 khagimoto (Guest)
on 2009-04-13 22:39
(Received via mailing list)
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
Af2ce6689213fdb78913a9662b18da6b?d=identicon&s=25 Rick (Guest)
on 2009-04-14 12:02
(Received via mailing list)
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.
Aca693e4cba5faa97725aef2c6dcfa58?d=identicon&s=25 khagimoto (Guest)
on 2009-04-14 17:24
(Received via mailing list)
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!!
Af2ce6689213fdb78913a9662b18da6b?d=identicon&s=25 Rick (Guest)
on 2009-04-14 19:34
(Received via mailing list)
Glad I could help.
This topic is locked and can not be replied to.