Okay cool. Is there a better way to call gsub_file protected method then by copying it into the generator? It's in Rails::Generator::Commands::Base.
On Dec 1, 12:35 pm, "Brandon Keepers" <[EMAIL PROTECTED]> wrote: > On Mon, Dec 1, 2008 at 10:52 AM, Tim K. <[EMAIL PROTECTED]> wrote: > > My question is this... Is there an better way to be doing this? It > > seems like a lot of insanity just to add a root route. > > You would think so, but there doesn't seem to be. `script/generate > resource` also adds routes, but looking at the source, they're doing > something similar: > > def route_resources(*resources) > resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') > sentinel = 'ActionController::Routing::Routes.draw do |map|' > > logger.route "map.resources #{resource_list}" > unless options[:pretend] > gsub_file 'config/routes.rb', > /(#{Regexp.escape(sentinel)})/mi do |match| > "#{match}\n map.resources #{resource_list}\n" > end > end > end > > Brandon > -- > --------------------------------------------------------------------------- > ----- > Training by Collective Idea: Ruby on Rails training in a vacation > settinghttp://training.collectiveidea.com– San Antonio, TX – Jan 20-23 --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---