Permalink
Browse files

Fix deprecation warning for error message on Rails 2.3.4

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 09d630d commit 7d50501535096d1f3a273b11868220fb7e7471f5 @carlosantoniodasilva carlosantoniodasilva committed with josevalim Sep 4, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 remarkable_activerecord/lib/remarkable_activerecord/base.rb
@@ -181,7 +181,11 @@ def assert_bad_value(model, attribute, value, error_message_to_expect=:invalid)
def error_message_from_model(model, attribute, message) #:nodoc:
if message.is_a? Symbol
message = if RAILS_I18N # Rails >= 2.2
- model.errors.generate_message(attribute, message, :count => '12345')
+ if ::ActiveRecord.const_defined?(:Error)
+ ::ActiveRecord::Error.new(model, attribute, message, :count => '12345').to_s
+ else
+ model.errors.generate_message(attribute, message, :count => '12345')
+ end
else # Rails <= 2.1
::ActiveRecord::Errors.default_error_messages[message] % '12345'
end

0 comments on commit 7d50501

Please sign in to comment.