Class: Devise::Webauthn::WebauthnIdGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/devise/webauthn/webauthn_id/webauthn_id_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_migrationObject



15
16
17
18
19
20
# File 'lib/generators/devise/webauthn/webauthn_id/webauthn_id_generator.rb', line 15

def generate_migration
  invoke "active_record:migration", [
    "add_webauthn_id_to_#{user_table_name}",
    "webauthn_id:string:uniq"
  ]
end

#show_instructionsObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/devise/webauthn/webauthn_id/webauthn_id_generator.rb', line 22

def show_instructions
  say <<~MSG
    WebAuthn ID field has been added! Next steps:

    1. Run the migration:
       rails db:migrate

    2. Make sure your User model includes :passkey_authenticatable in the devise line:
       devise :database_authenticatable, :passkey_authenticatable, ...
  MSG
end