Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Depend on activesupport >= 3.0.0.

Remove some Rails 2.1.x code.
  • Loading branch information...
commit c65e43a99932aee753f9e719c7ea7726c9cc7e26 1 parent 4705380
@gabebw gabebw authored
View
2  NEWS.md
@@ -26,3 +26,5 @@
* shoulda-matchers checks for all possible I18n keys, instead of just
e.g. `activerecord.errors.messages.blank`
+
+* Our very first dependency: ActiveSupport >= 3.0.0
View
16 lib/shoulda/matchers/active_model/helpers.rb
@@ -20,16 +20,12 @@ def pretty_error_messages(obj) # :nodoc:
def default_error_message(key, options = {})
model_name = options.delete(:model_name)
attribute = options.delete(:attribute)
- if Object.const_defined?(:I18n) # Rails >= 2.2
- I18n.translate( :"activerecord.errors.models.#{model_name}.attributes.#{attribute}.#{key}", {
- :default => [ :"activerecord.errors.models.#{model_name}.#{key}",
- :"activerecord.errors.messages.#{key}",
- :"errors.attributes.#{attribute}.#{key}",
- :"errors.messages.#{key}"
- ]}.merge(options))
- else # Rails <= 2.1.x
- ::ActiveRecord::Errors.default_error_messages[key] % options[:count]
- end
+ I18n.translate( :"activerecord.errors.models.#{model_name}.attributes.#{attribute}.#{key}", {
+ :default => [ :"activerecord.errors.models.#{model_name}.#{key}",
+ :"activerecord.errors.messages.#{key}",
+ :"errors.attributes.#{attribute}.#{key}",
+ :"errors.messages.#{key}"
+ ]}.merge(options))
end
end
end
View
2  shoulda-matchers.gemspec
@@ -17,6 +17,8 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
+ s.add_dependency('activesupport', '>= 3.0.0')
+
s.add_development_dependency('appraisal', '~> 0.4.0')
s.add_development_dependency('aruba')
s.add_development_dependency('bourne', '~> 1.1.2')
Please sign in to comment.
Something went wrong with that request. Please try again.