Sha256: f991d2c3d7fdd0e18665f1591cd561bacdcf15675a5f5777eff641f685c8b6d1

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

require "redmine/generators/plugin_name_attribute"
Rails::Generators.lookup %w(rails:resource_route)

module Redmine
  module Generators
    class ResourceRouteGenerator < Rails::Generators::ResourceRouteGenerator
      include PluginNameAttribute

      class_option :project, type: :boolean, default: true, desc: "Add project model relation"

      private
      def route(*args)
        return super unless options[:project]
        indented = route_string.split("\n").map { |l| "  #{l}" }.compact.join "\n"
        super %(scope "/projects/:project_id" do\n#{indented}\n  end)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redmine-generators-0.0.1 lib/redmine/generators/resource_route_generator.rb