#1288 ✓resolved
dhf (at f8technologies)

undefined method 'extract_options!'

Reported by dhf (at f8technologies) | May 22nd, 2010 @ 03:35 PM

Trying to require dm-validations and I get the following error:
NoMethodError: undefined method extract_options!' for [:default_error_messages]:Array<br/>

    from /usr/local/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/class/attribute_accessors.rb:30:in `cattr_writer'
    from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-validations-1.0.0.rc2/lib/dm-validations/validation_errors.rb:38

This is a standalone ruby application. extlib -v0.9.15 was updated before the datamapper bundle. I have not updated to Rails 3 at this point because this is not a rails app.

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 22nd, 2010 @ 09:08 PM

    • State changed from “new” to “resolved”

    (from [b343bd5f42ede7e5a5734ec7f2e6a9196beb7260]) Remove usage of cattr_writer

    • Gradually trying to remove usage of methods that were monkey-patched into ruby core/stdlib classes so that we can eventually remove deps on the extension libs that add them.

    [#1288 state:resolved] http://github.com/datamapper/dm-validations/commit/b343bd5f42ede7e5...

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 22nd, 2010 @ 09:17 PM

    • Assigned user set to “Dan Kubb (dkubb)”

    @dhf: can you try edge dm-validations and confirm this problem is resolved for you?

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 23rd, 2010 @ 12:11 AM

    @dhf: Good to hear in IRC that this worked. To answer your question "The thing I do not understand is why it was trying to use the acctivesupport instead of extlib.", the reason why this worked is because that method is provided by both AS and extlib. The intention of the code was that the extlib version of the method should be used, but instead the AS one was; which can be seen in the stacktrace.

    When extlib and AS are used together, the require order matters. You generally want to require extlib after AS, since it's methods are the ones that will be monkey-patched in last.

    In this particular case though, I don't see the point in using this method from either package since this is the only case in all of the official DM repos where the method was being used. Better to replace it with the 3 lines of code instead and remove one point of contention between the two libs.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

Referenced by