Hi- So I am using before_filter to manage authentication on my site. I see that you can add before_filter to a controller to restrict access to all methods in that controller. Is it possible to limit access to a specified set of actions, instead of the whole controller? Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
pete wrote:> Hi- > > So I am using before_filter to manage authentication on my site. I > see that you can add before_filter to a controller to restrict access > to all methods in that controller. > > Is it possible to limit access to a specified set of actions, instead > of the whole controller? > > Thanks!You mean like? class UsersController < ApplicationController before_filter :login_required, :except => [:index, :show] before_filter :check_administrator_role, :only => [:new, :edit, :create, :update] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Exactly, thank you! On Mar 21, 8:17 pm, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> pete wrote: > > Hi- > > > So I am using before_filter to manage authentication on my site. I > > see that you can add before_filter to a controller to restrict access > > to all methods in that controller. > > > Is it possible to limit access to a specified set of actions, instead > > of the whole controller? > > > Thanks! > > You mean like? > > class UsersController < ApplicationController > before_filter :login_required, :except => [:index, :show] > before_filter :check_administrator_role, :only => [:new, :edit, > :create, :update] > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---