Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

script/destroy scaffold

#1709

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

Reported by Marko · January 7th, 2009 @ 05:28 PM

State: resolved
Milestone: 3.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to incomplete

    Looks ok to me. Could you please submit a proper patch ? http://guides.rails.info/contrib... would be helpful.

    Thanks !

    March 8th, 2009 @ 12:09 AM

  2. Mike Breen
    Mike Breen
    • Tag set to 2.3.2, generator, patch, resource, scaffold

    I put Marco's fix into a patch.

    March 26th, 2009 @ 02:45 PM

  3. Pratik
    Pratik
    • State changed from incomplete to open

    March 26th, 2009 @ 02:45 PM

  4. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  5. Rohit Arondekar
    Rohit Arondekar

    Any updates to this ticket? Is this still an issue in rails 2.3.8 or Rails master?

    June 19th, 2010 @ 08:56 AM

  6. José Valim
    José Valim
    • State changed from open to resolved

    This is definitely fixed on master.

    June 21st, 2010 @ 10:19 AM