Class: ActiveRecord::Generators::CookieCryptGenerator
- Inherits:
-
Base
- Object
- Base
- ActiveRecord::Generators::CookieCryptGenerator
- Defined in:
- lib/generators/active_record/cookie_crypt_generator.rb
Instance Method Summary collapse
- #copy_cookie_crypt_migration_1_0 ⇒ Object
- #copy_cookie_crypt_migration_1_1 ⇒ Object
- #copy_cookie_crypt_migration_1_1_cleanup ⇒ Object
-
#copy_cookie_crypt_migration_all ⇒ Object
This should only be triggered on a system that has no previous install(s).
Instance Method Details
#copy_cookie_crypt_migration_1_0 ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/generators/active_record/cookie_crypt_generator.rb', line 18 def if ActiveRecord::Base.class_eval("#{table_name.camelize.singularize}.inspect['security_question_one: string'].blank?") && !@ignore_other_migrations migration_template "migration.rb", "db/migrate/cookie_crypt_add_to_#{table_name}" end end |
#copy_cookie_crypt_migration_1_1 ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/generators/active_record/cookie_crypt_generator.rb', line 26 def if ActiveRecord::Base.class_eval("#{table_name.camelize.singularize}.inspect['security_hash: text'].blank?") && !@ignore_other_migrations migration_template "migration_1_1.rb", "db/migrate/cookie_crypt_1_1_update_to_#{table_name}" end end |
#copy_cookie_crypt_migration_1_1_cleanup ⇒ Object
34 35 36 37 38 |
# File 'lib/generators/active_record/cookie_crypt_generator.rb', line 34 def 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 |
#copy_cookie_crypt_migration_all ⇒ Object
This should only be triggered on a system that has no previous install(s)
9 10 11 12 13 14 15 16 |
# File 'lib/generators/active_record/cookie_crypt_generator.rb', line 9 def if ActiveRecord::Base.class_eval("#{table_name.camelize.singularize}.inspect['security_question_one: string'].blank?") && ActiveRecord::Base.class_eval("#{table_name.camelize.singularize}.inspect['security_hash: text'].blank?") @ignore_other_migrations = true migration_template "migration_complete.rb", "db/migrate/cookie_crypt_complete_install_add_to_#{table_name}" end end |