Created
August 12, 2011 12:41
-
-
Save dagobah/1141954 to your computer and use it in GitHub Desktop.
How can I get access to the current user here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Watered down version, how do I get current_user in the initialize method? | |
module Protect | |
extend ActiveSupport::Concern | |
module ClassMethods | |
#stuff | |
end | |
module InstanceMethods | |
def initialize (*args, &block) | |
keys = current_user.keys | |
# Do some authorization checks | |
super(*args, &block) | |
end | |
end | |
end | |
##### | |
class MyController < ApplicationController | |
include Protect | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment