In my main controller, I have this:
class MainController < ApplicationController
before_filter do |controller|
logger.info "controller.request.format.html? = #{controller.request.format.html?}"
logger.info "controller.request.format.fbml? = #{controller.request.format.fbml?}"
controller.send :login_required if controller.request.format.html?
controller.send :facebook_auth_required if controller.request.format.fbml?
end
As expected, I get "true" for the ...fbml? line if a request comes from Facebook (my facebooker gem automatically sets the format). However, I get "5" for the ...html? line if the request comes from Facebook. Why would a method with a ? ever return a "5"? Isn't that against Rails conventions? Also, I think "5" is considered true so this might mess up my filters. Still looking into that...
Any ideas?