Sha256: ebf417efabddfbf3f7bb1b23f8475912f48428561d2b5cf371b125cbc2c69cbc

Contents?: true

Size: 933 Bytes

Versions: 1

Compression:

Stored size: 933 Bytes

Contents

require 'rails/generators/rails/resource/resource_generator'

module Rails
  module Generators
    class ScaffoldGenerator < ResourceGenerator #metagenerator
      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"

      hook_for :scaffold_controller, :required => true

      def copy_stylesheets_file
        if behavior == :invoke && options.stylesheets?
          template "scaffold.#{stylesheet_extension}", "app/assets/stylesheets/scaffold.#{stylesheet_extension}"
        end
      end

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

      private

      def stylesheet_extension
        options.stylesheet_engine.present? ?
          "css.#{options.stylesheet_engine}" : "css"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
railties-3.1.0.beta1 lib/rails/generators/rails/scaffold/scaffold_generator.rb