Topic: request.xhr?

Hi all. I am using RJS in my RoR application, and I have the following problem. In order to protect the pages I have set up this method in the ApplicationController:

before_filter :check_access
def check_access
  unless request.xhr?
    redirect_to(:controller => '/main')
    return
  end
end

I have put this method in the ApplicationController because I want all controllers to be protected so I won

Re: request.xhr?

You can use skip_before_filter

class MainController < ApplicationController
  skip_before_filter :check_access, :only => :index
end

Railscasts - Free Ruby on Rails Screencasts