Class: DeviseAuthy::Generators::DeviseAuthyGenerator

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

Instance Method Summary collapse

Instance Method Details

#inject_devise_authy_contentObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/devise_authy/devise_authy_generator.rb', line 9

def inject_devise_authy_content
  path = File.join("app","models","#{file_path}.rb")
  if File.exists?(path) &&
    !File.read(path).include?("authy_authenticatable")
    inject_into_file(path,
                     "authy_authenticatable, :",
                     :after => "devise :")
  end

  if File.exists?(path) &&
    !File.read(path).include?(":authy_id")
    inject_into_file(path,
                     ":authy_id, :last_sign_in_with_authy, ",
                     :after => "attr_accessible ") 
  end
end