Greg Hauptmann
2006-Oct-02 10:04 UTC
customizing generators - extend rails generators vs copy them???
Hi, I''ve got some generator tweaks I''d like to make (e.g. controllers, model & scaffold) but I''m wondering whether I should either (a) take a copy and modify the existing controllers or (b) try to extend the existing generators so as to better leverage rails upgrades in the future. Does anyone know whether (b) is possible? That is, is there a way to make changes/additions to the custom rails generators in a way that won''t break for future rails releases? Or is this difficult or not possible and I should really just create my own generators (based on the rails ones as a starting point). Tks Greg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Gareth Adams
2006-Oct-02 13:17 UTC
Re: customizing generators - extend rails generators vs copy them???
Greg Hauptmann <greg.hauptmann.ruby@...> writes:> > Hi,I''ve got some generator tweaks I''d like to make (e.g. controllers, model &scaffold) but I''m wondering whether I should either (a) take a copy and modify the existing controllers or (b) try to extend the existing generators so as to better leverage rails upgrades in the future.> Does anyone know whether (b) is possible? That is, is there a way to makechanges/additions to the custom rails generators in a way that won''t break for future rails releases? Or is this difficult or not possible and I should really just create my own generators (based on the rails ones as a starting point). Personally I''d go with taking a copy, otherwise there''s no way to tell whether the changes being made are going to have aneffect on the lines you''re adding. On the other hand, it''s definitely possible to call a generate script from your generate script, using m.dependency in your generate script, for example m.dependency ''model'', [@model_name] # adds or removes a model depending on # whether this script is being called with create or destroy Gareth --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---