The following code from the RailsSpace book:
  def correct_error_message(boundary, length)
    error_messages = ActiveRecord::Errors.default_error_messages
    if boundary == :max
      sprintf(error_messages[:too_long], length)
    elsif boundary == :min
      sprintf(error_messages[:too_short], length)
    else
      raise ArgumentError, "boundary must be :max or :min"
    end
  end

resulted in the following error message.
Loaded suite /home/rmartin/NetBeansProjects/TestForge/test/unit/
user_test
Started
DEPRECATION WARNING: ActiveRecord::Errors.default_error_messages has
been deprecated. Please use I18n.translate
('activerecord.errors.messages').. (called from default_error_messages
at /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
validations.rb:24)
....F.....
Finished in 0.201547 seconds.

  1) Failure:
test_screen_name_length_boundaries(UserTest)
    [/home/rmartin/NetBeansProjects/TestForge/test/unit/../
test_helper.rb:72:in `assert_length'
     /home/rmartin/NetBeansProjects/TestForge/test/unit/user_test.rb:
39:in `test_screen_name_length_boundaries'
     /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/testing/setup_and_teardown.rb:94:in `__send__'
     /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/testing/setup_and_teardown.rb:94:in `run']:
<"is too short (minimum is {{count}} characters)"> expected but was
<"is too short (minimum is 4 characters)">.

10 tests, 31 assertions, 1 failures, 0 errors

The deprecation warning I get but it doesn't appear as though the
error message is being manipulated correctly; any help out there?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to