Skip to content

Instantly share code, notes, and snippets.

@andyhite
Created September 27, 2013 01:06
Show Gist options
  • Save andyhite/6722858 to your computer and use it in GitHub Desktop.
Save andyhite/6722858 to your computer and use it in GitHub Desktop.
class ApplicationController
before_filter :override_current_user
...
private
def override_current_user
class_eval <<-METHODS, __FILE__, __LINE__ + 1
def current_user_with_sharding
do_stuff
current_user
do_other_stuff
end
alias_method_chain :current_user, :sharding
METHODS
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment