class Rodauth::OAuth::Rails::Generators::InstallGenerator

Private Class Methods

next_migration_number(dirname) click to toggle source

required by migration_template action

# File lib/generators/rodauth/oauth/install_generator.rb, line 32
def self.next_migration_number(dirname)
  ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Public Instance Methods

create_oauth_models() click to toggle source
# File lib/generators/rodauth/oauth/install_generator.rb, line 21
def create_oauth_models
  return unless defined?(ActiveRecord::Base)

  template "app/models/oauth_application.rb"
  template "app/models/oauth_grant.rb"
  template "app/models/oauth_token.rb"
end
create_rodauth_migration() click to toggle source
# File lib/generators/rodauth/oauth/install_generator.rb, line 15
def create_rodauth_migration
  return unless defined?(ActiveRecord::Base)

  migration_template "db/migrate/create_rodauth_oauth.rb", "db/migrate/create_rodauth_oauth.rb"
end

Private Instance Methods

adapter() click to toggle source
# File lib/generators/rodauth/oauth/install_generator.rb, line 42
def adapter
  ActiveRecord::Base.connection_config.fetch(:adapter)
end
migration_version() click to toggle source
# File lib/generators/rodauth/oauth/install_generator.rb, line 36
def migration_version
  if ActiveRecord.version >= Gem::Version.new("5.0.0")
    "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
  end
end