lib/generators/authtrail/install_generator.rb in authtrail-0.4.2 vs lib/generators/authtrail/install_generator.rb in authtrail-0.4.3

- old
+ new

@@ -20,11 +20,11 @@ end def generate_model case encryption when "lockbox" - template "model_lockbox.rb", "app/models/login_activity.rb" + template "model_lockbox.rb", "app/models/login_activity.rb", lockbox_method: lockbox_method when "activerecord" template "model_activerecord.rb", "app/models/login_activity.rb" else template "model_none.rb", "app/models/login_activity.rb" end @@ -66,9 +66,17 @@ else "none" end else abort "Error: encryption must be lockbox, activerecord, or none" + end + end + + def lockbox_method + if defined?(Lockbox::VERSION) && Lockbox::VERSION.to_i < 1 + "encrypts" + else + "has_encrypted" end end end end end