Sha256: 0d36762fadbe1a4ebfff7ce5f3a53b7d7d41b21c19fb37ee603c7ae82634e2b4
Contents?: true
Size: 778 Bytes
Versions: 2
Compression:
Stored size: 778 Bytes
Contents
module Kublog module UserIntegration module Common def self.included(base) base.send :include, InstanceMethods base.send :helper_method, :current_user, :is_admin?, :signed_in? end module InstanceMethods # Uses session[:user_id] to get the user session # should be able to change user for x name of model def current_user @current_user ||= User.find_by_id(session[:user_id]) end # Tries admin? method for user to filter out publishing actions def is_admin? current_user && current_user.try(:admin?) end ## Sign in helper method def signed_in? !!current_user end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kublog-0.9.0 | lib/kublog/user_integration/common.rb |
kublog-0.0.1.1 | lib/kublog/user_integration/common.rb |