Hi,

I just tried the following:
in application.rb -> before :ensure_authenticated (this enables
authentication for all controllers, so I don't need to specifically
add it at the top of new controllers)
in users.rb -> before :ensure_authenticated, :exclude => [:new] (re-
enables authentication for the users controller except for the new
action)

I don't know what happens under the hood: is the users controller
filter completely overwriting the application controller filter? Or
will the filter be called twice? Is this intended functionality, or is
this a fluke which will be fixed in future versions?

Thanks,
Tiberiu

On Mar 31, 11:20 am, Mr_Tibs <[email protected]> wrote:
> Hi Yehuda,
>
> I'm trying to enable authentication for my whole application, except
> for the "new" action of the Users controller. I have
> "before :ensure_authenticated" in my application controller and
> "skip_before :ensure_authenticated" in my Users controller. I wish I
> could say something like "skip_before :ensure_authenticated, :only =>
> [:new]". The problem is that skip_before does not take any action
> arguments, so I wanted to write my own.
>
> Thanks,
> Tiberiu
>
> On Mar 27, 7:03 pm, Yehuda Katz <[email protected]> wrote:
>
> > What precisely are you trying to do? It sounds potentially like you could
> > achieve what you want is a less generic way for your app.
>
> > -- Yehuda
>
> > On Sat, Mar 28, 2009 at 1:50 AM, Mr_Tibs <[email protected]> wrote:
>
> > > Hi,
>
> > > I'm trying to overwrite skip_before() of Merb::AbstractController -
> > > currently it doesn't take in :only & :exclude => :action.
> > > So, if I have the following code:
>
> > > class Merb::AbstractController
> > >  def self.skip_before(filter, action)
> > >    if self.action_name == action
> > >      skip_filter(self._before_filters , filter)
> > >    end
> > >  end
> > > end
>
> > > Where in the merb-app directory structure do I put it? Why is it
> > > generating an error on self.action_name?
>
> > > Thanks,
> > > Tiberiu
>
> > --
> > Yehuda Katz
> > Developer | Engine Yard
> > (ph) 718.877.1325
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to