NoMethodError (undefined method `to_hash' for #<CGI::Session:0x2b73dc4b9c60>)

Limos's Avatar

Limos

09 Nov, 2009 05:28 AM via web

I get this error after upgrading to the newest Hoptoad and running Rails 2.2.2.

The error is happening here:

/vendor/plugins/hoptoad_notifier/lib/hoptoad_notifier/catcher.rb:40:in request_data_for_hoptoad'

  1. Support Staff 2 Posted by thoughtbot on 09 Nov, 2009 07:04 PM

    thoughtbot's Avatar

    Hi,

    Can you paste the output of script/about ?

    Thanks,
    Mike.

  2. 3 Posted by Limos on 09 Nov, 2009 10:04 PM

    Limos's Avatar

    About your application's environment
    Ruby version 1.8.7 (universal-darwin10.0)
    RubyGems version 1.3.5
    Rails version 2.2.2
    Active Record version 2.2.2
    Action Pack version 2.2.2
    Active Resource version 2.2.2
    Action Mailer version 2.2.2
    Active Support version 2.2.2
    Edge Rails revision unknown
    Application root /trunk
    Environment development
    Database adapter mysql
    Database schema version 20091106050711

  3. 4 Posted by system on 10 Nov, 2009 04:10 PM

    system's Avatar

    An internal ticket was created for this discussion

  4. Support Staff 5 Posted by Joe Ferris on 10 Nov, 2009 04:11 PM

    Joe Ferris's Avatar

    Hi,

    This may be an incompatibility with the new notifier and older versions of Rails. We'll check into this and make sure that all supported versions work as expected.

    Thanks,

    -Joe

  5. 6 Posted by SocialVibe on 13 Nov, 2009 08:23 PM

    SocialVibe's Avatar

    Seeing the same thing on Rails 2.2.2 with the newest notifier plugin. Any updates?

  6. 7 Posted by assembla on 14 Nov, 2009 05:20 PM

    assembla's Avatar

    Why are you encouraging people to upgrade if the version is not stable ?
    Any ETA when will it be fixed ?

  7. 8 Posted by Matt Powell on 16 Nov, 2009 03:44 AM

    Matt Powell's Avatar

    Same here, on Rails 2.0.2. This is actually kind of upsetting: I know 2.0.2 is an older version, but I checked compatibility in the README before upgrading the plugin, and now things are broken :(

    matt@Yavin:sucklings.co.nz[master]$ rake hoptoad:test(in /Users/matt/clients/sucklings.co.nz)
    ** [Hoptoad] Notifier 2.0.3 ready to catch errors
    Configuration:
                         port: 80
          environment_filters: []
                 notifier_url: "http://hoptoadapp.com"
     development_environments: []
            http_open_timeout: 2
                      api_key: "d2f297abb797ad1ccb5ab04bce1dd621"
             notifier_version: "2.0.3"
            http_read_timeout: 5
                   proxy_port: nil
               params_filters: ["password", "password_confirmation"]
            ignore_by_filters: []
                   proxy_user: nil
             environment_name: nil
            backtrace_filters: [#<Proc:0x0000000104d286d8@/Users/matt/clients/suckling
                 project_root: nil
                       secure: false
            ignore_user_agent: []
                     protocol: "http"
                   proxy_host: nil
                       ignore: [ActiveRecord::RecordNotFound, ActionController::Routin
           development_lookup: true
                         host: "hoptoadapp.com"
                notifier_name: "Hoptoad Notifier"
                   proxy_pass: nil
    Setting up the Controller.
    Processing request.
    
    
    Processing HoptoadVerificationController#index (for 0.0.0.0 at 2009-11-16 16:39:13) [GET]
      Session ID: 
      Parameters: {}
      SQL (0.118810)   SET SQL_AUTO_IS_NULL=0
    Raising 'HoptoadTestingException' to simulate application failure.
    rake aborted!
    undefined method `to_hash' for #<ActionController::TestSession:0x104c932e0>
    
    (See full trace by running task with --trace)
    matt@Yavin:sucklings.co.nz[master*]$ script/about
    About your application's environment
    Ruby version              1.8.7 (i686-darwin10.0.0)
    RubyGems version          1.3.5
    Rails version             2.0.2
    Active Record version     2.0.2
    Action Pack version       2.0.2
    Active Resource version   2.0.2
    Action Mailer version     2.0.2
    Active Support version    2.0.2
    Application root          /Users/matt/clients/sucklings.co.nz
    Environment               development
    Database adapter          mysql
    Database schema version   48
    
  8. 9 Posted by Matt Powell on 16 Nov, 2009 03:54 AM

    Matt Powell's Avatar

    In the meantime, anybody having problems can try putting the following in config/hoptoad.rb:

    class ActionController::TestSession
      def to_hash
        data
      end
    end
    

    Seems to work for me.

  9. 10 Posted by Matt Powell on 16 Nov, 2009 03:59 AM

    Matt Powell's Avatar

    Oh: should mention that that code is only for TestSession, and fixes for other classes will vary depending on what you're using.

  10. Support Staff 11 Posted by Joe Ferris on 16 Nov, 2009 06:22 PM

    Joe Ferris's Avatar

    Hi everybody,

    Sorry for the inconvenience. We just released version 2.0.4 of the notifier, which contains fixes for several versions of Rails. Can you guys try this out and confirm that your issues are fixed with the latest notifier?

    Thanks,

    -Joe

  11. 12 Posted by Matt Powell on 16 Nov, 2009 09:34 PM

    Matt Powell's Avatar

    Seems to be working in 2.0.2. Thanks Joe!

  12. Support Staff 13 Posted by Joe Ferris on 16 Nov, 2009 09:39 PM

    Joe Ferris's Avatar

    Thanks, Matt. I'm marking this as resolved, but if anybody is still running into the "undefined method to_hash" issue, please let us know.

    -Joe

  13. Joe Ferris resolved this discussion on 16 Nov, 2009 09:39 PM.

Comments are currently closed for this discussion. You can start a new one.