Class: ActionController::UrlRewriter
- Inherits:
-
Object
- Object
- ActionController::UrlRewriter
- Defined in:
- lib/facebooker/rails/facebook_url_rewriting.rb
Instance Method Summary collapse
-
#can_safely_access_request_parameters? ⇒ Boolean
rails blindly tries to merge things that may be nil into the parameters.
- #link_to_canvas?(params, options) ⇒ Boolean
-
#link_to_new_canvas? ⇒ Boolean
RESERVED_OPTIONS << :canvas.
- #rewrite(*args) ⇒ Object
Methods included from Facebooker::Rails::BackwardsCompatibleParamChecks
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
41 42 43 |
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 41 def can_safely_access_request_parameters? @request.request_parameters end |
#link_to_canvas?(params, options) ⇒ Boolean
34 35 36 37 38 |
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 34 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 || (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
RESERVED_OPTIONS << :canvas
30 31 32 |
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 30 def link_to_new_canvas? one_or_true @request.parameters["fb_sig_in_new_facebook"] end |
#rewrite(*args) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/facebooker/rails/facebook_url_rewriting.rb', line 45 def rewrite(*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 super(*args) end end |