This project is archived and is in readonly mode.

#1709 ✓resolved
Marko

script/destroy scaffold

Reported by Marko | January 7th, 2009 @ 05:28 PM | in 3.x

I have created custom scaffold which sets up route like this in manifest: route map.resources :articles, :member => {:da_state => :put, :ne_state => :put}, :path_prefix => ':locale/admin'

Which is fine when doing script/generate, but on destroy I get error:

   route  map.resources :articles, :member => {:da_state => :put, :ne_state => :put}, :path_prefix => ':locale/admin'

/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/rails_generator/commands.rb:531: warning: regexp has invalid interval /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/rails_generator/commands.rb:531: warning: regexp has }' without escape

Problem seams to be fixed after escaping regex in: vendor/rails/railties/lib/rails_generator/commands.rb:531


def route_resources(*resources)
  resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
  look_for = "\n  map.resources #{resource_list}\n"
  logger.route "map.resources #{resource_list}"
-  gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
+  gsub_file 'config/routes.rb', /(#{Regexp.escape(look_for)})/mi, ''
end

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages