[Rails] Scaffolding continued

Jeff Abbott fdivbug at gmail.com
Fri Jan 14 20:57:52 GMT 2005


This caught me by surprise, too.  The fact that it overwrites existing
files and their content is very disconcerting and I found out about it
the hard way.  Fortunately it was just during a tutorial.  It'd be
nice if it renamed existing files (and mentioned that it was doing so)
rather than just clobbering what's there.

Jeff

On Fri, 14 Jan 2005 09:33:25 -0700, Dale K. Hawkins <dkhawk at gmail.com> wrote:
> It seems to me that backups should be made before overwriting existing
> files.  I currently do this by hand and find myself checking for
> possible conflicts.
> 
> Should I work on a patch?
> 
> -Dale
> 
> 
> On Fri, 14 Jan 2005 09:47:26 -0500, Jim Van Fleet <jim at jimvanfleet.com> wrote:
> > >>In starting step 3, I found out that I'd be having to re-establish a
> > >>couple of relationship entities that had vanished!  This was definitely
> > >>a surprise.
> > >
> > >
> > > Do you mean files that you had made but then were nuked by a generator?
> > > I'm not sure I understand what's going on here for you.
> >
> > This is exacly what I mean.  In particular, when I issued the command:
> >
> > ruby script/generate scaffold Artist
> >
> > My models/artist.rb file was nuked.  Looking at the code for the
> > generator script that comes with Rails, the "generate scaffold" command
> > impacts the model and fixtures, in addition to the other stuff that I
> > expected it to touch.
> >
> > The usage for the command makes it clear that it's designed for creating
> > a new model.  But if a model file already exists, should it be
> > clobbered?  I am on a Cygwin Ruby 1.8.1 and Rails 0.9.3 and that's the
> > behavior I see.  I didn't see anything explicitly expressing intent to
> > delete files in rails_generator.rb (where the model creating comes from).
> >
> > Cheers,
> >
> > Jim
> > _______________________________________________
> > Rails mailing list
> > Rails at lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
> >
> 
> 
> --
> This is my sig.  Isn't it cool....
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


More information about the Rails mailing list