Class: ActiveAuthentication::OmniauthableGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/active_authentication/omniauthable/omniauthable_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_modelObject



6
7
8
9
10
11
12
# File 'lib/generators/active_authentication/omniauthable/omniauthable_generator.rb', line 6

def generate_model
  invoke "active_record:model", %w[Authentication uid:string provider:string user:references auth_data:json], skip_collision_check: true

  if behavior == :invoke
    inject_into_class "app/models/authentication.rb", "Authentication", "  validates :provider, presence: true\n  validates :uid, presence: true, uniqueness: {scope: :provider}\n"
  end
end