2014-11-06 18:56:00 +01:00
|
|
|
module OrdersHelper
|
2014-11-10 17:50:11 +01:00
|
|
|
|
2014-11-23 21:12:31 +01:00
|
|
|
def ordering(user)
|
|
|
|
session[:order_user_id] = user.id
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_ordering_user
|
|
|
|
@current_ordering_user ||= User.find_by(id: session[:order_user_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_order
|
|
|
|
session.delete(:order_user_id)
|
|
|
|
@current_ordering_user = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def ordering?
|
|
|
|
!current_ordering_user.nil?
|
|
|
|
end
|
2014-11-10 22:57:37 +01:00
|
|
|
|
2014-11-06 18:56:00 +01:00
|
|
|
end
|