Module: Facebook::Rails

Defined in:
lib/facebook-graphclient/rails.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



30
31
32
33
34
# File 'lib/facebook-graphclient/rails.rb', line 30

def self.included(controller)
  if controller.respond_to?(:helper_method)
    controller.helper_method :fb, :facebook
  end
end

Instance Method Details

#facebookObject Also known as: fb



35
36
37
38
39
40
41
42
# File 'lib/facebook-graphclient/rails.rb', line 35

def facebook
  unless request.env['facebook.helper']
    fb = Facebook::GraphClient.new(self.class.facebook_settings.merge(:cookies => cookies))
    env['facebook.helper'] = fb
  end

  env['facebook.helper']
end