Greg Hauptmann
2006-Nov-13 10:30 UTC
Can I change the order for before_filter''s between application.rb filters & another filters from another controller that inherits from "ApplicationController" ???
Hi, Can I change the order for before_filter''s between application.rb filters & another filters from another controller that inherits from "ApplicationController" ??? For example I have 3 before_filters in application.rb, and these seem to be handled before the before_filter that I have in another specific controller that inherits from ApplicationController (in this particular case the specific controller is part of a plugin, hence is in the vendor directory). I really want the plugin vendors controller before_filter to fire before the ones in the application.rb. Tks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thorsten L
2006-Nov-13 10:59 UTC
Re: Can I change the order for before_filter''s between application.rb filters & another filters from another controller that inherits from "ApplicationController" ???
never used it, but rails docs got this: prepend_before_filter :yourfilteraction from the docs: "Using before_filter and after_filter appends the specified filters to the existing chain. That''s usually just fine, but some times you care more about the order in which the filters are executed. When that''s the case, you can use prepend_before_filter and prepend_after_filter. Filters added by these methods will be put at the beginning of their respective chain and executed before the rest. For example: " maybe that works, not sure though. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Greg Hauptmann
2006-Nov-14 10:56 UTC
Re: Can I change the order for before_filter''s between application.rb filters & another filters from another controller that inherits from "ApplicationController" ???
Tks - this worked - wonder what would happen however if you had multiple plugins, including vendor plugins. How would you control the order then? On 11/13/06, Thorsten L <duplexxx-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > > never used it, but rails docs got this: > > prepend_before_filter :yourfilteraction > > from the docs: > "Using before_filter and after_filter appends the specified filters to > the existing chain. That''s usually just fine, but some times you care > more about the order in which the filters are executed. When that''s > the case, you can use prepend_before_filter and prepend_after_filter. > Filters added by these methods will be put at the beginning of their > respective chain and executed before the rest. For example: " > > maybe that works, not sure though. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---