Module: Sinatra::ReFacebookHelper

Defined in:
lib/refacebook/sinatra.rb

Instance Method Summary collapse

Instance Method Details

#fbml_redirect(url) ⇒ Object

Since redirect doesn’t work in the canvas since it relies on JavaScript Location field. This is a replacement which uses fbml as a means to redirect to the given url.



20
21
22
# File 'lib/refacebook/sinatra.rb', line 20

def fbml_redirect(url)
  halt "<fb:redirect url=\"#{url}\" />"
end

#in_canvas?Boolean

If in the facebook canvas returns true

Returns:

  • (Boolean)


7
8
9
# File 'lib/refacebook/sinatra.rb', line 7

def in_canvas?
  params["fb_sig_in_canvas"].eql? "1"
end

Return a concatenated url with the canvas url and the path



12
13
14
15
# File 'lib/refacebook/sinatra.rb', line 12

def link_from_canvas(path="/")
  path = path.eql?("/") ? "" : "/#{path}"
  "#{options.canvas_url}#{path}"
end