I would like to respond to different formats in my Rails app:
respond_to do |format|
logger.info "in main format block, request.format.fbml? = #{request.format.fbml?}"
format.html # index.html.erb
format.fbml # index.fbml.erb
end
This is simple. If facebook is requesting a page, return a .fbml.erb file, otherwise return a .html.erb file.
My app knows to send over main.fbml.erb from the layouts directory instead of main.html.erb but it never sends app/views/main/index.fbml.erb in the respond to block if I respond as shown above in my main controller's index action.
Anyone know how to easily do this?
I use the gem "facebooker" which sets the format to fbml automatically.
EDIT Output from my Rails log:
in main format block, request.format.fbml? = true
Rendering template within layouts/main
Rendering main/index