# Before\_filter for a specific controller/action

**URL:** <https://www.ruby-forum.com/t/before-filter-for-a-specific-controller-action/156055>\
**Category:** Rails\
**Created:** [December 19, 2008, 8:58pm UTC](https://www.ruby-forum.com/t/before-filter-for-a-specific-controller-action/156055 "2008-12-19T20:58:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dark-omen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@dark-omen](https://www.ruby-forum.com/u/dark-omen)\
**Post date:** [December 19, 2008, 8:58pm UTC](https://www.ruby-forum.com/t/before-filter-for-a-specific-controller-action/156055/1 "2008-12-19T20:58:50Z")

</div>

I’m learning about before\_filter, implementing a simple “you must be  
logged on” thing.

It works great, but I need to allow people to create a player as well.

By writing the except as attached, that works, but then everyone has  
access to all “new” methods, which I don’t really want.

Can someone help me with how to properly construct this to limit  
non-logged in access to the new method of the players controller?

---

<div class="post-metadata">

**Author:** ![dark-omen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@dark-omen](https://www.ruby-forum.com/u/dark-omen)\
**Post date:** [December 19, 2008, 9:29pm UTC](https://www.ruby-forum.com/t/before-filter-for-a-specific-controller-action/156055/2 "2008-12-19T21:29:05Z")

</div>

This post might help:

[http://rails.lighthouseapp.com/projects/8994/tickets/946-pass-blocks-to-beforeafter-filter-methods-using-with-option](http://rails.lighthouseapp.com/projects/8994/tickets/946-pass-blocks-to-beforeafter-filter-methods-using-with-option)

On Dec 19, 11:58 am, Scott P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![dark-omen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c68b51/32.png) [@dark-omen](https://www.ruby-forum.com/u/dark-omen)\
**Post date:** [December 19, 2008, 10:52pm UTC](https://www.ruby-forum.com/t/before-filter-for-a-specific-controller-action/156055/3 "2008-12-19T22:52:53Z")

</div>

On 19 Dec 2008, at 19:58, Scott P. wrote:

> I’m learning about before\_filter, implementing a simple “you must be  
> logged on” thing.
> 
> It works great, but I need to allow people to create a player as well.

stick  
skip\_before\_filter :foo, :only =\> :new  
in PlayersController

Fred
