Sha256: 833bbc7730cac546e82314540d93966e16b3f62d6a09339d14f9b5ee7c192d5b

Contents?: true

Size: 572 Bytes

Versions: 42

Compression:

Stored size: 572 Bytes

Contents

module Rails
  module Generators
    class ControllerGenerator < NamedBase
      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
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
railties-3.0.20 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.19 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.18 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.17 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.16 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.15 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.14 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.13 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.13.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.12 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.12.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.11 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.10 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.10.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.9 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.9.rc5 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.9.rc4 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.9.rc3 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.9.rc1 lib/rails/generators/rails/controller/controller_generator.rb
railties-3.0.8 lib/rails/generators/rails/controller/controller_generator.rb