Sha256: 74bc212cf215ac419b53e54a9d842431ac98ff077afb40ca939bb2739464a3ec
Contents?: true
Size: 570 Bytes
Versions: 4
Compression:
Stored size: 570 Bytes
Contents
# prepend this module module RailsDataConnection def self.prepended(model) model.identified_by :current_user end def connect self.current_user = find_verified_user super end protected # todo why session got nil def find_verified_user if session && session['user_id'] User.find_by id: session['user_id'] else logger.error 'An unauthorized connection attempt was rejected' nil end end def session session_key = Rails.application.config.session_options[:key] cookies.encrypted[session_key] end end
Version data entries
4 entries across 4 versions & 1 rubygems