Class: Mongoid::Generators::DeviseGoogleAuthenticatorGenerator

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



9
10
11
# File 'lib/generators/mongoid/devise_google_authenticator_generator.rb', line 9

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

#migration_dataObject



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

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