26 Aug 09:06
Tutorial for writing generators?
From: Mohit Sindhwani <mo_mail@...>
Subject: Tutorial for writing generators?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2006-08-26 07:10:27 GMT
Subject: Tutorial for writing generators?
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2006-08-26 07:10:27 GMT
Hi, I just completed the first version of an application. I now find that subsequent version require me to do pretty much the same thing all over again but for different types of things. For example, I need to: 1. Create a new model (say foo) and a set of related migrations 2. Add a bunch of 'belongs_to' statements to the new model 3. Add 'has_many foo' to a couple of other models 4. Create a controller and a set of views for displaying the data in foo (like scaffold) 5. Add a before_filter to this controller 6. Create a link to the index page of this controller in my main layout 7. Modify the create method in this controller to create the links between the foreign keys 8. Create a POST string to pass data to this controller (to be used by another program) 9. ...and so on. Normally, I would write that list up and go about doing it a step at a time. However, when it comes to Rails, I feel lazy :-S It seems that the DRY way is to use a generator. Is there a good tutorial that I could follow? Thanks, Mohit. --~--~---------~--~----~------------~-------~--~----~ 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@...(Continue reading)
RSS Feed