Class: ActiveRecord::Generators::CookieCryptGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/active_record/cookie_crypt_generator.rb

Instance Method Summary collapse

Instance Method Details



8
9
10
11
12
# File 'lib/generators/active_record/cookie_crypt_generator.rb', line 8

def copy_cookie_crypt_migration_1_0
  if ActiveRecord::Base.class_eval("#{table_name.camelize.singularize}.inspect['security_question_one: string'].blank?")
    migration_template "migration.rb", "db/migrate/cookie_crypt_add_to_#{table_name}"
  end
end


14
15
16
17
18
# File 'lib/generators/active_record/cookie_crypt_generator.rb', line 14

def copy_cookie_crypt_migration_1_1
  if ActiveRecord::Base.class_eval("#{table_name.camelize.singularize}.inspect['security_hash: text'].blank?")
    migration_template "migration_1_1.rb", "db/migrate/cookie_crypt_1_1_update_to_#{table_name}"
  end
end


20
21
22
23
24
# File 'lib/generators/active_record/cookie_crypt_generator.rb', line 20

def copy_cookie_crypt_migration_1_1_cleanup
  if $generate_1_1_cleanup_migration
    migration_template "migration_1_1_cleanup.rb", "db/migrate/cookie_crypt_1_1_cleanup_to_#{table_name}"
  end
end