[Facebooker-talk] Hash in @current_adapter (instead of FacebookAdapter)

Heiko Seebach heiko.seebach at web.de
Thu Feb 19 17:08:33 EST 2009


Hi everybody,

I'm using the current facebooker version from 
http://github.com/mmangino/facebooker/tree/master in production, and I 
had a strange problem.


About every fifth (or tenth) time I (and others too) reload our homepage 
with the browser I got the following stacktrace:


ActionView::TemplateError (undefined method `api_key' for 
#<Hash:0x2aeb25fd3b68>) on line #2 of facebook/_login_button.html.erb:
1: <%= fb_connect_javascript_tag %>
2: <%= init_fb_connect "XFBML"%>


    vendor/plugins/facebooker/lib/facebooker.rb:104:in `send'
    vendor/plugins/facebooker/lib/facebooker.rb:104:in `api_key'
    
vendor/plugins/facebooker/lib/facebooker/rails/helpers/fb_connect.rb:15:in 
`init_fb_connect'
    app/views/facebook/_login_button.html.erb:2:in 
`_run_erb_47app47views47facebook47_login_button46html46erb'
    
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_view/base.rb:342:in 
`send'
    
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_view/base.rb:342:in 
`execute'
    
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_view/template_handlers/compilable.rb:29:in 
`send'
    
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_view/template_handlers/compilable.rb:29:in 
`render'
    
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_view/partial_template.rb:20:in 
`render'
    
/var/lib/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/benchmarking.rb:26:in 
`benchmark'
...


This happened even when I deleted all session and domain cookies before 
the reload.


I debugged very long time and now and found out, thats ometimes there 
was a Hash in the
@current_adapter
of facebooker.rb
instead of a FacebookAdapter object

@current_adatper.inspect
showed, that the hash is the facebook_config object! (so the 
FacebookAdapter wrapper around it is missing)



I fixed it temporarily by disabling loading a specific adapter
    def current_adapter
      #@current_adapter ||
      Facebooker::AdapterBase.default_adapter
    end


so that always the default_adapter is used.
This works for now and for me.

I've no idea how this could happen, but maybe it helps somebody to find 
this bug or has any idea about it.


thanks, Heiko Seebach




More information about the Facebooker-talk mailing list