Class: DeviseGoogleAuthenticator::Generators::DeviseGoogleAuthenticatorGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/devise_google_authenticator/devise_google_authenticator_generator.rb

Instance Method Summary collapse

Instance Method Details

#inject_devise_google_authenticator_contentObject



9
10
11
12
13
14
15
16
17
# File 'lib/generators/devise_google_authenticator/devise_google_authenticator_generator.rb', line 9

def inject_devise_google_authenticator_content
	path = File.join("app","models","#{file_path}.rb")

	if File.exists?(path)
	  inject_into_file(path, "google_authenticatable, :", :after => "devise :")
	  inject_into_file(path, "gauth_enabled, :gauth_tmp, :gauth_tmp_datetime, :", :after => "attr_accessible :") if needs_attr_accessible?
	  inject_into_class(path, class_name, "\tattr_accessor :gauth_token\n")
	end
end