Sha256: ffdb1259d13a1e251ddb115fd17233f8fe31dc5ac1096bc5672b60f38d13dd9c

Contents?: true

Size: 887 Bytes

Versions: 4

Compression:

Stored size: 887 Bytes

Contents

require 'rails/generators/resource_helpers'

module Rails
  module Generators
    class ScaffoldControllerGenerator < NamedBase
      include ResourceHelpers

      check_class_collision :suffix => "Controller"

      class_option :orm, :banner => "NAME", :type => :string, :required => true,
                         :desc => "ORM to generate the controller for"

      class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"

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

      hook_for :template_engine, :test_framework, :as => :scaffold

      # Invoke the helper using the controller name (pluralized)
      hook_for :helper, :as => :scaffold do |invoked|
        invoke invoked, [ controller_name ]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
railties-3.0.0.beta4 lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb
railties-3.0.0.beta3 lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb
railties-3.0.0.beta2 lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb
railties-3.0.0.beta lib/generators/rails/scaffold_controller/scaffold_controller_generator.rb