>>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
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-HW8W3q4hXPgyx5EpGhof3g@public.gmane.org> 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-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- This is my sig. Isn''t it cool....
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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-HW8W3q4hXPgyx5EpGhof3g@public.gmane.org> 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-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > This is my sig. Isn''t it cool.... > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Probably better to fail or prompt to rename. Automatic renaming would also be non-intuitive. Nick On Fri, 14 Jan 2005 15:57:52 -0500, Jeff Abbott <fdivbug-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-HW8W3q4hXPgyx5EpGhof3g@public.gmane.org> 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-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > > This is my sig. Isn''t it cool.... > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Nicholas Van Weerdenburg