Sha256: 53068dbd341b1d25be5b477e2c4a33e55a34bbf1489c5e0f6fb78a3879534555

Contents?: true

Size: 579 Bytes

Versions: 30

Compression:

Stored size: 579 Bytes

Contents

module Rails
  module Generators
    class ControllerGenerator < NamedBase # :nodoc:
      argument :actions, type: :array, default: [], banner: "action action"
      check_class_collision suffix: "Controller"

      def create_controller_files
        template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb")
      end

      def add_routes
        actions.reverse.each do |action|
          route %{get "#{file_name}/#{action}"}
        end
      end

      hook_for :template_engine, :test_framework, :helper, :assets
    end
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
railties-4.0.13 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.13.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.11.1 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.12 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.11 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.10 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.10.rc2 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.10.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.9 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.8 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.7 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.6 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.6.rc3 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.6.rc2 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.6.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.5 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.4 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.4.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.3 lib/rails/generators/rails/controller/controller_generator.rb
railties-4.0.2 lib/rails/generators/rails/controller/controller_generator.rb