hi my app uses before_filter for authorization in ApplicationController which filter ''create'', ''update'' and so on in every controller. But let''s say i want to exclude ''create'' in one particular controller how would i do this best. I''m missing something like : class ApplicationController before_filter check_permission , :exclude => [MailerController::create] ... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Dec 22, 2009 at 1:47 AM, Aladin <ahmed.al-jabaji-HhYlybFjWgQ@public.gmane.org> wrote:> hi > > my app uses before_filter for authorization in ApplicationController > which filter ''create'', ''update'' and so on in every controller. But > let''s say i want to exclude ''create'' in one particular controller how > would i do this best. > I''m missing something like : > > class ApplicationController > before_filter check_permission , :exclude => > [MailerController::create] > ... > >Hi, you can do the following: before_filter :check_permission, :except => :create Good luck, -Conrad> -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
This would exclude all create methods in all controllers which is exactly the the opposite i need. is using skip_before_filter the rails way to exclude before_filter for a certain controller? On 22 Dez., 12:17, Conrad Taylor <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Dec 22, 2009 at 1:47 AM, Aladin <ahmed.al-jab...-HhYlybFjWgQ@public.gmane.org> wrote: > > hi > > > my app uses before_filter for authorization in ApplicationController > > which filter ''create'', ''update'' and so on in every controller. But > > let''s say i want to exclude ''create'' in one particular controller how > > would i do this best. > > I''m missing something like : > > > class ApplicationController > > before_filter check_permission , :exclude => > > [MailerController::create] > > ... > > Hi, you can do the following: > > before_filter :check_permission, :except => :create > > Good luck, > > -Conrad > > > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 22 Dec 2009, at 12:17, Conrad Taylor wrote:> my app uses before_filter for authorization in ApplicationController > which filter ''create'', ''update'' and so on in every controller. But > let''s say i want to exclude ''create'' in one particular controller how > would i do this best. > I''m missing something like : > > class ApplicationController > before_filter check_permission , :exclude => > [MailerController::create] > ... > > > Hi, you can do the following: > > before_filter :check_permission, :except => :createOr use skip_before_filter in that controller, as you can clearly find in the API documentation: http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html (Filter chain skipping). Best regards Peter De Berdt -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2009/12/22 Aladin <ahmed.al-jabaji-HhYlybFjWgQ@public.gmane.org>:> This would exclude all create methods in all controllers which is > exactly the the opposite i need. > is using skip_before_filter the rails way to exclude before_filter for > a certain controller?You can use :only and :except with skip_before_filter, so put the skip in the specific controller, specifying which actions to skip in that controller. Colin> > > On 22 Dez., 12:17, Conrad Taylor <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On Tue, Dec 22, 2009 at 1:47 AM, Aladin <ahmed.al-jab...-HhYlybFjWgQ@public.gmane.org> wrote: >> > hi >> >> > my app uses before_filter for authorization in ApplicationController >> > which filter ''create'', ''update'' and so on in every controller. But >> > let''s say i want to exclude ''create'' in one particular controller how >> > would i do this best. >> > I''m missing something like : >> >> > class ApplicationController >> > before_filter check_permission , :exclude => >> > [MailerController::create] >> > ... >> >> Hi, you can do the following: >> >> before_filter :check_permission, :except => :create >> >> Good luck, >> >> -Conrad >> >> >> >> > -- >> >> > 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<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> > . >> > For more options, visit this group at >> >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.