Sha256: da1983931ef36542aedea335693a40a3c3fc884fe8f4b9e6d49fd8e98d83bdb5

Contents?: true

Size: 666 Bytes

Versions: 173

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true

# require 'generators/rails/resource_route/resource_route_generator'

class PgResourceRouteGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('templates', __dir__)

  # Properly nests namespaces passed into a generator
  #
  #   $ bin/rails generate resource admin/users/products
  #
  # should give you
  #
  #   namespace :admin do
  #     namespace :users do
  #       resources :products
  #     end
  #   end
  def add_resource_route
    return if options[:actions].present?

    route_s = <<~RUBY
      pg_resource(:#{file_name.pluralize})
    RUBY
    route route_s, namespace: regular_class_path
  end
end

Version data entries

173 entries across 173 versions & 1 rubygems

Version Path
pg_rails-7.6.28 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.27 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.26 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.25 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.24 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.24.pre.5 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.24.pre.4 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.24.pre.3 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.23 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.22 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.22.pre.3 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.22.pre.2 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.22.pre.1 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.21 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.21.pre.11 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.21.pre.10 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.21.pre.9 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.21.pre.8 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.21.pre.7 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb
pg_rails-7.6.21.pre.6 pg_scaffold/lib/generators/pg_resource_route/pg_resource_route_generator.rb