Class: ActiveRecord::Generators::DeviseTwoFactorGenerator
- Inherits:
-
Base
- Object
- Base
- ActiveRecord::Generators::DeviseTwoFactorGenerator
- Defined in:
- lib/generators/active_record/devise_two_factor_generator.rb
Instance Method Summary collapse
Instance Method Details
#content ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/generators/active_record/devise_two_factor_generator.rb', line 22 def content <<RUBY attr_encrypted :otp_auth_secret attr_encrypted :otp_recovery_secret validates :otp_auth_secret, symmetric_encryption: true validates :otp_recovery_secret, symmetric_encryption: true RUBY end |
#copy_devise_migration ⇒ Object
8 9 10 |
# File 'lib/generators/active_record/devise_two_factor_generator.rb', line 8 def copy_devise_migration migration_template 'migration.rb', "db/migrate/devise_two_factor_add_to_#{table_name}.rb" end |
#inject_field_types ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/generators/active_record/devise_two_factor_generator.rb', line 12 def inject_field_types class_path = if namespaced? class_name.to_s.split("::") else [class_name] end inject_into_class(model_path, class_path.last, content) if model_exists? end |