Sha256: 4879cd8fe37bcbc1c4806d470a2efd773e415a0f6041ba36be08ff34e1af06e2
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
Rails::Generator::Commands::Create.class_eval do def route_namespaced_resources(namespace, *resources) resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') sentinel = 'ActionController::Routing::Routes.draw do |map|' logger.route "#{namespace}.resources #{resource_list}" unless options[:pretend] gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match| "#{match}\n map.namespace(:#{namespace}) do |#{namespace}|\n #{namespace}.resources #{resource_list}\n end\n" end end end end Rails::Generator::Commands::Destroy.class_eval do def route_namespaced_resources(namespace, *resources) resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') look_for = "\n #{namespace}.resources #{resource_list}\n" logger.route "#{namespace}.resources #{resource_list}" unless options[:pretend] gsub_file 'config/routes.rb', /(#{look_for})/mi, '' end end end Rails::Generator::Commands::List.class_eval do def route_namespaced_resources(namespace, *resources) resource_list = resources.map { |r| r.to_sym.inspect }.join(', ') logger.route "#{namespace}.resources #{resource_list}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ghart-nifty-generators-0.3.0.1 | rails_generators/nifty_admin_scaffold/lib/insert_commands.rb |