Sha256: f5487c908e9aadb941cb4905a10e93751457ff2eac8853f659ce68e3ee51c3f8

Contents?: true

Size: 903 Bytes

Versions: 4

Compression:

Stored size: 903 Bytes

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 :stylesheets, type: :boolean, desc: "Generate Stylesheets"
      class_option :stylesheet_engine, desc: "Engine for Stylesheets"

      def handle_skip
        @options = @options.merge(stylesheets: false) unless options[:assets]
        @options = @options.merge(stylesheet_engine: false) unless options[:stylesheets]
      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

4 entries across 4 versions & 2 rubygems

Version Path
challah-1.0.0 vendor/bundle/gems/railties-4.0.0/lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-4.0.0 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-4.0.0.rc2 lib/rails/generators/rails/scaffold/scaffold_generator.rb
railties-4.0.0.rc1 lib/rails/generators/rails/scaffold/scaffold_generator.rb