lib/ez/controller.rb in ez-0.5.0 vs lib/ez/controller.rb in ez-0.6.0
- old
+ new
@@ -1,22 +1,22 @@
module ActionController
class Base
helper_method :current_user
- helper_method :logged_in?
+ helper_method :user_signed_in?
- def logged_in?
+ def user_signed_in?
session[:user_id].present?
end
- def user_login(user)
+ def sign_in_as(user)
@current_user = user
- session[:user_id] = user ? user.id : nil
+ session[:user_id] = user.try(:id)
user
end
- def user_logout
- user_login nil
+ def sign_out
+ sign_in_as nil
end
def current_user(klass = User)
@current_user ||= klass.send(:find_by, id: session[:user_id])
end