Class: ActionController::UrlRewriter
Instance Method Summary
collapse
#one_or_true, #zero_or_false
Instance Method Details
#can_safely_access_request_parameters? ⇒ Boolean
rails blindly tries to merge things that may be nil into the parameters. Make sure this won’t break
42
43
44
|
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 42
def can_safely_access_request_parameters?
@request.request_parameters
end
|
#link_to_canvas?(params, options) ⇒ Boolean
35
36
37
38
39
|
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 35
def link_to_canvas?(params, options)
option_override = options[:canvas]
return false if option_override == false option_override || (can_safely_access_request_parameters? && (one_or_true(@request.parameters["fb_sig_in_canvas"]) || one_or_true(@request.parameters[:fb_sig_in_canvas]) || one_or_true(@request.parameters["fb_sig_is_ajax"]) ))
end
|
#link_to_new_canvas? ⇒ Boolean
31
32
33
|
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 31
def link_to_new_canvas?
one_or_true @request.parameters["fb_sig_in_new_facebook"]
end
|
#rewrite_url_with_facebooker(*args) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 46
def rewrite_url_with_facebooker(*args)
options = args.first.is_a?(Hash) ? args.first : args.last
is_link_to_canvas = link_to_canvas?(@request.request_parameters, options)
if is_link_to_canvas && !options.has_key?(:host)
options[:host] = Facebooker.canvas_server_base
end
options.delete(:canvas)
Facebooker.request_for_canvas(is_link_to_canvas) do
rewrite_url_without_facebooker(*args)
end
end
|