lib/authlogic/config.rb in authlogic-4.3.0 vs lib/authlogic/config.rb in authlogic-4.4.0
- old
+ new
@@ -1,14 +1,30 @@
module Authlogic
module Config
+ E_USE_NORMAL_RAILS_VALIDATION = <<~EOS.freeze
+ This Authlogic configuration option (%s) is deprecated. Use normal
+ ActiveRecord validations instead. For example, instead of the Authlogic
+ method validates_length_of_email_field_options, you can use
+
+ validates :email, length: { ... }
+
+ These deprecated Authlogic methods will be removed in the next major version.
+ EOS
+
def self.extended(klass)
klass.class_eval do
class_attribute :acts_as_authentic_config
self.acts_as_authentic_config ||= {}
end
end
private
+
+ def deprecate_authlogic_config(method_name)
+ ::ActiveSupport::Deprecation.warn(
+ format(E_USE_NORMAL_RAILS_VALIDATION, method_name)
+ )
+ end
# This is a one-liner method to write a config setting, read the config
# setting, and also set a default value for the setting.
def rw_config(key, value, default_value = nil)
if value.nil?