Sha256: 3f84ccb48c03959d39e929eb74bb4cc4084f10c945f145929c376fc983eeda26

Contents?: true

Size: 796 Bytes

Versions: 8

Compression:

Stored size: 796 Bytes

Contents

require 'rails/generators/resource_helpers'

module Rails
  class HelperlessScaffoldControllerGenerator < Rails::Generators::NamedBase
    include Rails::Generators::ResourceHelpers

    check_class_collision suffix: "Controller"

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

    argument :attributes, type: :array, default: [], banner: "field:type field:type"

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

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

    hook_for :template_engine, :test_framework, as: :scaffold
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sal-engine-0.2.0 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb
sal-engine-0.1.0 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb
sal-engine-0.0.6 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb
sal-engine-0.0.5 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb
sal-engine-0.0.4 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb
sal-engine-0.0.3 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb
sal-engine-0.0.2 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb
sal-engine-0.0.1 lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb