Sha256: ea83cad80ebcd347118d3c6602ed8c77f99a34c9de9b747e4a94189757b68218

Contents?: true

Size: 751 Bytes

Versions: 39

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

require "rails/generators/resource_helpers"
require "rails/generators/rails/model/model_generator"

module Rails
  module Generators
    class ResourceGenerator < ModelGenerator # :nodoc:
      include ResourceHelpers

      hook_for :resource_controller, required: true do |controller|
        invoke controller, [ controller_name, options[:actions] ]
      end

      class_option :actions, type: :array, banner: "ACTION ACTION", default: [],
                             desc: "Actions for the resource controller"

      hook_for :resource_route, required: true

      class << self
        def desc(description = nil)
          ERB.new(File.read(usage_path)).result(binding)
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 5 rubygems

Version Path
railties-7.1.4 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.0 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.0.rc1 lib/rails/generators/rails/resource/resource_generator.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/railties-7.1.3.4/lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.0.beta3 lib/rails/generators/rails/resource/resource_generator.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/railties-7.1.3.4/lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.0.beta2 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.3.4 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.0.beta1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.3.2 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.3.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.3 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.2 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.0 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.0.rc2 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.0.rc1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.0.beta1 lib/rails/generators/rails/resource/resource_generator.rb