Sha256: 1465c3396e61f52251d2b9363324b03da3af66ca5f02dacc4454160c484441a3

Contents?: true

Size: 477 Bytes

Versions: 10

Compression:

Stored size: 477 Bytes

Contents

module Adminpanel
	module SessionsHelper

		def sign_in(user)
			cookies.permanent[:remember_token] = user.remember_token
			self.current_user = user
		end

		def signed_in?
			!current_user.nil?
		end

		def current_user=(user)
			@current_user = user
		end

		def current_user
			@current_user ||= User.find_by_remember_token(cookies[:remember_token])
		end

		def sign_out
			self.current_user = nil
			cookies.delete(:remember_token)
		end
	end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
adminpanel-0.1.1 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.1.0cl.2 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.1.0cl app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.1.0 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.0.7 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.0.6.1 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.0.6 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.0.5 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.0.4 app/helpers/adminpanel/sessions_helper.rb
adminpanel-0.0.3 app/helpers/adminpanel/sessions_helper.rb