jam-cloud/ruby/lib/jam_ruby/models/anonymous_user.rb

26 lines
545 B
Ruby

# this was added to support the idea of an anonymous user interacting with our site; needed by the ShoppingCart
# over time it might make sense to beef this up and to use it conistently in anonymous interactions
module JamRuby
class AnonymousUser
attr_accessor :id
def initialize(id)
@id = id
end
def shopping_carts
ShoppingCart.where(anonymous_user_id: @id)
end
def destroy_all_shopping_carts
ShoppingCart.destroy_all(anonymous_user_id: @id)
end
def admin
false
end
end
end