ungsophy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Aug-27 07:49 UTC
Can FILTERS AND VERIFICATION functions take arguments?
Hi, I have some problems in using filter. My filter functions need to have arguments, but filter functions take only symbol that refer to function name. Consider the following code: class BlogController < ApplicationController before_filter :authorize For instance, authorize need arguments. So how can I pass arguments to filter function? Any helps always appreciate. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mikkel Bruun
2007-Aug-27 08:11 UTC
Re: Can FILTERS AND VERIFICATION functions take arguments?
Sophy Eung wrote:> Hi, > > I have some problems in using filter. My filter functions need to have > arguments, but filter functions take only symbol that refer to > function name. Consider the following code: > > class BlogController < ApplicationController > > before_filter :authorize > > For instance, authorize need arguments. So how can I pass arguments to > filter function? > > Any helps always appreciate.what arguments does your filter need?? -- 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 -~----------~----~----~----~------~----~------~--~---
Jacob Atzen
2007-Aug-27 08:44 UTC
Re: Can FILTERS AND VERIFICATION functions take arguments?
ungsophy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Hi, > > I have some problems in using filter. My filter functions need to have > arguments, but filter functions take only symbol that refer to > function name. Consider the following code: > > class BlogController < ApplicationController > > before_filter :authorize > > For instance, authorize need arguments. So how can I pass arguments to > filter function?You can''t. It doesn''t really make sense to pass arguments to a filter. But your before_filter can access the usual ActionController hashes (params, session, etc) which is where you would put stuff that may vary between requests. -- Cheers, - Jacob Atzen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---