lib/generators/motorhead/controller_generator.rb in motorhead-0.4.1 vs lib/generators/motorhead/controller_generator.rb in motorhead-0.5.0
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
require 'rails/generators/rails/controller/controller_generator'
module Motorhead
module Generators
class ControllerGenerator < ::Rails::Generators::ControllerGenerator
@@ -19,11 +20,18 @@
template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb")
end
# override
private
- def generate_routing_code(action)
- "get '#{file_name}/#{action}'"
+ if (Rails::VERSION::MAJOR == 5) && (Rails::VERSION::MINOR == 0)
+ def generate_routing_code(action)
+ # https://github.com/rails/rails/commit/d2be2a9166
+ " get '#{file_name}/#{action}'"
+ end
+ else
+ def generate_routing_code(action)
+ "get '#{file_name}/#{action}'"
+ end
end
end
end
end