Sha256: fa4848ba7483e025af6793ea282f9cc6e6b68d6810e2ec620f535dcefaa419a1
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require 'rails/generators/rails/controller/controller_generator' module Motorhead module Generators class ControllerGenerator < ::Rails::Generators::ControllerGenerator source_root ::Rails::Generators::ControllerGenerator.source_root remove_hook_for :template_engine, :test_framework class << self def source_paths [File.expand_path('../templates', __FILE__), *super] end end # override def create_controller_files @destination_stack[@destination_stack.size - 1] = File.join @destination_stack.last, 'app/engines', class_path template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb") end # override private 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motorhead-0.5.0 | lib/generators/motorhead/controller_generator.rb |