Skip to content

Instantly share code, notes, and snippets.

View Driptap's full-sized avatar

Sinan Güçlü Driptap

View GitHub Profile
@Driptap
Driptap / current_user.rb
Created July 22, 2014 09:56
Current user concern used in various Ruby on Rails projects
module CurrentUser
extend ActiveSupport::Concern
included do
helper_method :current_user
end
def current_user
return @current_user if defined?(@current_user)
@current_user = User.find_by(id: session[:id])