Permalink
Browse files

add a little fix to authlogic, as in documentation stated, the I18n

message should be inside a lambda. Otherwise it will be always the
default I18n language and will not be evaluation on request time
  • Loading branch information...
1 parent b91683d commit db01cf108985bd176e1885a3c85450020d4bcc45 @aka47 aka47 committed May 16, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/authlogic/acts_as_authentic/email.rb
  2. +1 −1 lib/authlogic/acts_as_authentic/login.rb
@@ -65,7 +65,7 @@ def merge_validates_length_of_email_field_options(options = {})
# * <tt>Default:</tt> {:with => Authlogic::Regex.email, :message => lambda {I18n.t('error_messages.email_invalid', :default => "should look like an email address.")}}
# * <tt>Accepts:</tt> Hash of options accepted by validates_format_of
def validates_format_of_email_field_options(value = nil)
- rw_config(:validates_format_of_email_field_options, value, {:with => Authlogic::Regex.email, :message => I18n.t('error_messages.email_invalid', :default => "should look like an email address.")})
+ rw_config(:validates_format_of_email_field_options, value, {:with => Authlogic::Regex.email, :message => lambda {I18n.t('error_messages.email_invalid', :default => "should look like an email address.")}})
end
alias_method :validates_format_of_email_field_options=, :validates_format_of_email_field_options
@@ -107,4 +107,4 @@ def self.included(klass)
end
end
end
-end
+end
@@ -62,7 +62,7 @@ def merge_validates_length_of_login_field_options(options = {})
# * <tt>Default:</tt> {:with => Authlogic::Regex.login, :message => lambda {I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")}}
# * <tt>Accepts:</tt> Hash of options accepted by validates_format_of
def validates_format_of_login_field_options(value = nil)
- rw_config(:validates_format_of_login_field_options, value, {:with => Authlogic::Regex.login, :message => I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")})
+ rw_config(:validates_format_of_login_field_options, value, {:with => Authlogic::Regex.login, :message => lambda {I18n.t('error_messages.login_invalid', :default => "should use only letters, numbers, spaces, and .-_@ please.")}})
end
alias_method :validates_format_of_login_field_options=, :validates_format_of_login_field_options

0 comments on commit db01cf1

Please sign in to comment.