Patrick wrote:> Hi,
>
> I see from this post
>
>
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/97e333daab05b725/8252c90cb9c36f6d?lnk=gst&q=passing+parameter+before_filter#8252c90cb9c36f6d
>
> it can specify the Proc in the before_filter function, but when
> specify when action apply this filter, it raise an syntax error, such
> as rthe following code
>
> before_filter {|controller| c.send(:catalog_access,
> [current_user])}, :only=>[:manage_catalog]
>
> Will raise an syntax error
>
> app/controllers/catalogs_controller.rb:7: syntax error, unexpected
> '','', expecting kEND
> before_filter {|controller| c.send(:catalog_access,
> [current_user])}, :only=>[:manage_catalog]
>
> Is before_filter using Proc can specify which action to filtering
> with ?
>
> Thank,
> Patrick
This would be works fine.
before_filter :only=>[:manage_catalog] do|controller|
c.send(:catalog_access,[current_user])
end
--
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
-~----------~----~----~----~------~----~------~--~---