Central Method to Call access_control

1 view
Skip to first unread message

rebeldev

unread,
Nov 13, 2009, 11:19:42 AM11/13/09
to acl9-discuss
I was wondering if it was possible to create a central method to call
access_control.

So, in my application controller I would have a method called:

def mycontrol
access_control do
...
end

end

I'd like to run it from before_filter in several of my controllers
I might even think of adding parameters to the mycontrol method.
Which poses another problem of how I would do that.

Thanks for the help.

oleg dashevskii

unread,
Nov 16, 2009, 12:16:34 AM11/16/09
to acl9-d...@googlegroups.com
Try following:

class ApplicationControler < ...
   def self.my_control
      access_control do
           # smth
      end
   end
end

class OtherController < ApplicationController
   my_control
end

2009/11/13 rebeldev <fa...@mobilefringe.com>



--
Oleg.
Reply all
Reply to author
Forward
0 new messages