This project is archived and is in readonly mode.

#5230 ✓invalid
Jakub Suder

incorrect deprecation notice in ActiveModel::Errors

Reported by Jakub Suder | July 28th, 2010 @ 04:44 PM

Method add() in ActiveModel::Errors calls its method generate_message() in a way which is marked as deprecated:

DEPRECATION WARNING: ActiveModel::Errors#generate_message(attributes, custom_message) has been deprecated.
Use ActiveModel::Errors#generate_message(attributes, :message => 'your message') instead. (called from generate_message at .../activemodel-3.0.0.rc/lib/active_model/errors.rb:289)

Comments and changes to this ticket

  • Jakub Suder

    Jakub Suder August 9th, 2010 @ 11:26 PM

    • Title changed from “ActiveModel::Errors causes a deprecation notice on itself” to “incorrect deprecation notice in ActiveModel::Errors”

    Oops, my bad, that was actually an issue with Mongoid, not ActiveModel.

    The deprecation message is confusing though, it looks like it was copy-pasted from another method. Instead of:

    "ActiveModel::Errors#generate_message(attributes, custom_message) has been deprecated. Use ActiveModel::Errors#generate_message(attributes, :message => 'your message') instead."

    it should be something like:

    "ActiveModel::Errors#generate_message(attributes, :default => 'your message') has been deprecated. Use ActiveModel::Errors#generate_message(attributes, :message => 'your message') instead."

    (The warning is caused by using the key :default in the options, not by passing a string as second argument, which probably wouldn't work at all.)

  • Rohit Arondekar

    Rohit Arondekar August 11th, 2010 @ 02:01 PM

    • State changed from “new” to “invalid”
    • Importance changed from “” to “Low”
  • Ryan Bigg

    Ryan Bigg October 14th, 2010 @ 05:29 AM

    • Tag cleared.

    Automatic cleanup of spam.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages