Class: DeviseGauth::Generators::DeviseGauthGenerator

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

Instance Method Summary collapse

Instance Method Details

#inject_devise_gauth_contentObject



10
11
12
13
14
15
16
17
18
# File 'lib/generators/devise_gauth/devise_gauth_generator.rb', line 10

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

  return unless File.exist?(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