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
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/railties-7.1.3.4/lib/rails/generators/rails/resource/resource_generator.rb
railties-8.0.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-8.0.0.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.2.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.5.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-8.0.0 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.2 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.5 lib/rails/generators/rails/resource/resource_generator.rb
railties-8.0.0.rc2 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.1.2 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.4.2 lib/rails/generators/rails/resource/resource_generator.rb
railties-8.0.0.rc1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.2.1.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-7.1.4.1 lib/rails/generators/rails/resource/resource_generator.rb
railties-8.0.0.beta1 lib/rails/generators/rails/resource/resource_generator.rb
omg-railties-8.0.0.alpha9 lib/rails/generators/rails/resource/resource_generator.rb
omg-railties-8.0.0.alpha8 lib/rails/generators/rails/resource/resource_generator.rb
omg-railties-8.0.0.alpha7 lib/rails/generators/rails/resource/resource_generator.rb
omg-railties-8.0.0.alpha4 lib/rails/generators/rails/resource/resource_generator.rb
omg-railties-8.0.0.alpha3 lib/rails/generators/rails/resource/resource_generator.rb