Skip to content

Commit

Permalink
fix I18n.translate key for edge rails [thoughtbot#80]
Browse files Browse the repository at this point in the history
  • Loading branch information
cristibalan authored and rmm5t committed Sep 20, 2008
1 parent a692f6d commit 8a111a6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/shoulda/active_record/macros.rb
Expand Up @@ -3,7 +3,7 @@ module Shoulda # :nodoc:
module ActiveRecord # :nodoc:
DEFAULT_ERROR_MESSAGES =
if Object.const_defined?(:I18n)
I18n.translate('active_record.error_messages')
I18n.translate('activerecord.errors.messages')
else
::ActiveRecord::Errors.default_error_messages
end
Expand Down Expand Up @@ -43,7 +43,7 @@ def load_all_fixtures
#
# Options:
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:blank]</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:blank]</tt>
#
# Example:
# should_require_attributes :name, :phone_number
Expand All @@ -65,7 +65,7 @@ def should_require_attributes(*attributes)
#
# Options:
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:taken]</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:taken]</tt>
# * <tt>:scoped_to</tt> - field(s) to scope the uniqueness to.
#
# Examples:
Expand Down Expand Up @@ -163,7 +163,7 @@ def should_have_readonly_attributes(*attributes)
#
# Options:
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:invalid]</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:invalid]</tt>
#
# Example:
# should_not_allow_values_for :isbn, "bad 1", "bad 2"
Expand Down Expand Up @@ -206,9 +206,9 @@ def should_allow_values_for(attribute, *good_values)
#
# Options:
# * <tt>:short_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:too_short] % range.first</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:too_short] % range.first</tt>
# * <tt>:long_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:too_long] % range.last</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:too_long] % range.last</tt>
#
# Example:
# should_ensure_length_in_range :password, (6..20)
Expand Down Expand Up @@ -258,7 +258,7 @@ def should_ensure_length_in_range(attribute, range, opts = {})
#
# Options:
# * <tt>:short_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:too_short] % min_length</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:too_short] % min_length</tt>
#
# Example:
# should_ensure_length_at_least :name, 3
Expand Down Expand Up @@ -289,7 +289,7 @@ def should_ensure_length_at_least(attribute, min_length, opts = {})
#
# Options:
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:wrong_length] % length</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:wrong_length] % length</tt>
#
# Example:
# should_ensure_length_is :ssn, 9
Expand Down Expand Up @@ -324,9 +324,9 @@ def should_ensure_length_is(attribute, length, opts = {})
#
# Options:
# * <tt>:low_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:inclusion]</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:inclusion]</tt>
# * <tt>:high_message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:inclusion]</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:inclusion]</tt>
#
# Example:
# should_ensure_value_in_range :age, (0..100)
Expand Down Expand Up @@ -369,7 +369,7 @@ def should_ensure_value_in_range(attribute, range, opts = {})
#
# Options:
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:not_a_number]</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:not_a_number]</tt>
#
# Example:
# should_only_allow_numeric_values_for :age
Expand Down Expand Up @@ -623,7 +623,7 @@ def should_have_indices(*columns)
#
# Options:
# * <tt>:message</tt> - value the test expects to find in <tt>errors.on(:attribute)</tt>.
# Regexp or string. Default = <tt>I18n.translate('active_record.error_messages')[:accepted]</tt>
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages')[:accepted]</tt>
#
# Example:
# should_require_acceptance_of :eula
Expand Down

0 comments on commit 8a111a6

Please sign in to comment.