Sha256: 04e54066299c701731e1d6c15dbaf12b0a61c06ebb177bc63e6e752233bdca6a

Contents?: true

Size: 984 Bytes

Versions: 29

Compression:

Stored size: 984 Bytes

Contents

# require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'

module Rails
  module Generators
    class ActiveScaffoldControllerGenerator < NamedBase # metagenerator
      include ResourceHelpers

      def self.source_root
        @source_root ||= File.join(File.dirname(__FILE__), 'templates')
      end

      check_class_collision :suffix => 'Controller'

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

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

      hook_for :test_framework, :as => :scaffold

      def create_view_root_folder
        empty_directory File.join('app/views', controller_file_path)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
active_scaffold-3.4.43 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.42 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.41.1 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.41 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.40 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.39 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.38 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.37 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.36 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.35 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.34 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.33 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.32 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.31 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.30 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.29 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.28 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.27 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.26 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
active_scaffold-3.4.25 lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb