# Skipping filters according to request format

**URL:** <https://www.ruby-forum.com/t/skipping-filters-according-to-request-format/90660>\
**Category:** Rails\
**Created:** [March 30, 2007, 7:37pm UTC](https://www.ruby-forum.com/t/skipping-filters-according-to-request-format/90660 "2007-03-30T19:37:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [March 30, 2007, 7:37pm UTC](https://www.ruby-forum.com/t/skipping-filters-according-to-request-format/90660/1 "2007-03-30T19:37:32Z")

</div>

I’m trying to set up my RESTful controllers to allow public reading of  
data  
only when they are requesting XML. I’m using acts\_as\_authenticated for  
my  
authentication, and am basically trying to do something like this:

class MyController \< AC  
before\_filter :login\_required do |controller|  
true if controller.params[:format] == ‘xml’  
end

def index  
@models = Model.find(:all)

```
respond_to do |wants|
  wants.html { render :nothing => true }
  wants.js { render :partial => 'index' }
  wants.xml { render :xml => @models.to_xml }
end

```

end  
end

Should I just make the whole action public or is there a proper way of  
doing  
this?

Thanks

Jason
