Class: Doorkeeper::EnablePolymorphicResourceOwnerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb

Overview

Generates migration with polymorphic resource owner required database columns for Doorkeeper Access Token and Access Grant models.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object


29
30
31
# File 'lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb', line 29

def self.next_migration_number(dirname)
  ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Instance Method Details

#enable_polymorphic_resource_ownerObject


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb', line 16

def enable_polymorphic_resource_owner
  migration_template(
    "enable_polymorphic_resource_owner_migration.rb.erb",
    "db/migrate/enable_polymorphic_resource_owner.rb",
    migration_version: migration_version,
  )
  gsub_file(
    "config/initializers/doorkeeper.rb",
    "# use_polymorphic_resource_owner",
    "use_polymorphic_resource_owner",
  )
end