Class: ActionController::UrlRewriter
- Inherits:
-
Object
- Object
- ActionController::UrlRewriter
- Defined in:
- lib/facebooker/rails/facebook_url_rewriting.rb
Instance Method Summary collapse
- #link_to_canvas?(params, options) ⇒ Boolean
- #link_to_new_canvas? ⇒ Boolean
- #rewrite_url_with_facebooker(*args) ⇒ Object
Instance Method Details
#link_to_canvas?(params, options) ⇒ Boolean
19 20 21 22 23 |
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 19 def link_to_canvas?(params, ) option_override = [:canvas] return false if option_override == false # important to check for false. nil should use default behavior option_override || @request.parameters["fb_sig_in_canvas"] == "1" || @request.parameters[:fb_sig_in_canvas] == "1" end |
#link_to_new_canvas? ⇒ Boolean
16 17 18 |
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 16 def link_to_new_canvas? @request.parameters["fb_sig_in_new_facebook"] == "1" end |
#rewrite_url_with_facebooker(*args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 25 def rewrite_url_with_facebooker(*args) = args.first.is_a?(Hash) ? args.first : args.last is_link_to_canvas = link_to_canvas?(@request.request_parameters, ) if is_link_to_canvas && !.has_key?(:host) [:host] = Facebooker.canvas_server_base end .delete(:canvas) Facebooker.request_for_canvas(is_link_to_canvas) do rewrite_url_without_facebooker(*args) end end |