Sha256: d6bb47ee93559bb1abfe562b3c01cd6334e9714e18d2bc2f96c4e5c347a53fa0

Contents?: true

Size: 1.13 KB

Versions: 126

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

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]
      end

      hook_for :scaffold_controller, required: true

      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

126 entries across 118 versions & 9 rubygems

Version Path
railties-6.1.7.10 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.9 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.8 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.7 lib/rails/generators/rails/scaffold/scaffold_generator.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.6 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.5 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.4 lib/rails/generators/rails/scaffold/scaffold_generator.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.3 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.2 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7.1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.0.6.1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.7 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.0.6 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.1.6.1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.0.5.1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.2.8.1 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-5.2.8 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-6.0.5 lib/rails/generators/rails/scaffold/scaffold_generator.rb