Class: Mongoid::Generators::DeviseGauthGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Devise::Generators::OrmHelpers
Defined in:
lib/generators/mongoid/devise_google_authenticator_generator.rb

Instance Method Summary collapse

Instance Method Details

#inject_field_typesObject



11
12
13
# File 'lib/generators/mongoid/devise_google_authenticator_generator.rb', line 11

def inject_field_types
  inject_into_file model_path, migration_data, after: "include Mongoid::Document\n" if model_exists?
end

#migration_dataObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/mongoid/devise_google_authenticator_generator.rb', line 15

def migration_data
<<RUBY
  # Google Authenticator
  field :gauth_secret, type: String
  field :gauth_enabled, type: Boolean, default: 'f'
  field :gauth_tmp, type: String
  field :gauth_tmp_datetime, type: DateTime

RUBY
end