Topic: before_filter and respond_to
I need to prevent access to my whole app except for some actions that respond to a particular format (e.g. xml)
So in my ApplicationController I have (BTW authlogic used here)
To accomplish this task i came up with this solution inside my controller:
before_filter :require_user, :except => [:index] before_filter(:only => :index) do |controller| controller.send(:require_user) unless controller.request.format.xml? end
repeating this snippet of code for all the action's respond_to formats I need to allow...
how can I DRY out the code?
Last edited by tejo (2009-10-20 03:41:04)