Sha256: 1e74e0069e3e537718ab19fa48aa755ac7313154524f7f3a04e60a20a8ad6298

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

require "rails/generators/rails/resource/resource_generator"

module Rails
  module Generators
    class ScaffoldGenerator < ResourceGenerator # :nodoc:
      remove_hook_for :resource_controller
      remove_class_option :actions

      class_option :api, type: :boolean
      class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets"
      class_option :stylesheet_engine, desc: "Engine for Stylesheets"
      class_option :assets, type: :boolean
      class_option :resource_route, type: :boolean
      class_option :scaffold_stylesheet, type: :boolean

      def handle_skip
        @options = @options.merge(stylesheets: false) unless options[:assets]
        @options = @options.merge(stylesheet_engine: false) unless options[:stylesheets] && options[:scaffold_stylesheet]
        @options = @options.merge(system_tests: false) if options[:api]
      end

      hook_for :scaffold_controller, required: true

      hook_for :system_tests, as: :system

      hook_for :assets do |assets|
        invoke assets, [controller_name]
      end

      hook_for :stylesheet_engine do |stylesheet_engine|
        if behavior == :invoke
          invoke stylesheet_engine, [controller_name]
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
railties-5.1.7 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.7.rc1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.6.2 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.6.1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.6 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.5 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.5.rc1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.4 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.4.rc1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.3 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.3.rc3 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.3.rc2 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.3.rc1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.2 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.2.rc1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.0 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.0.rc2 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.0.rc1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.1.0.beta1 lib/rails/generators/rails/scaffold/scaffold_generator.rb