In your application_controller.rb application, you can try the following:
class ApplicationController < ActionController::Base before_filter :validate_user private def validate_user()
when placing material in the application controller, it should be available in all controllers, however, if you do not need to confirm that this is the current user (say, maybe the home page), you may need to use skip_before_filter in any specific controller (for a specific action) which he needs, for example, in the page controller, for example
class PagesController < ApplicationController skip_before_filter :validate_user, :only => [:home, :about] end
For more information about this link, link to guides for guides on filters . There may be more effective ways to achieve this.
Hope this helps
source share