require 'rack/request'

# Extend Rack::Request to add some helpers for FB
class Request < ::Rack::Request
  def params
    rack_input = env["rack.input"].read
    Rack::Utils.parse_query(rack_input, "&")
  end

  def facebook?
    params["signed_request"].present?
  end
end
require 'rack/request'

# Extend Rack::Request to add some helpers for FB
class Request < ::Rack::Request
  def params
    rack_input = env["rack.input"].read
    @params ||= Rack::Utils.parse_query(rack_input, "&")
  end

  def facebook?
    params["signed_request"].present?
  end
end
Save params to instance var as rack.input read only read once
Save params to instance var as rack.input read only read once
