Class: Basket

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/basket.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#user_numberObject

Returns the value of attribute user_number.



13
14
15
# File 'app/models/basket.rb', line 13

def user_number
  @user_number
end

Class Method Details

.expireObject



23
24
25
26
# File 'app/models/basket.rb', line 23

def self.expire
  Basket.will_expire(Time.zone.now.beginning_of_day).destroy_all
  logger.info "#{Time.zone.now} baskets expired!"
end

Instance Method Details

#check_suspendedObject



15
16
17
18
19
20
21
# File 'app/models/basket.rb', line 15

def check_suspended
  if user
    errors[:base] << I18n.t('basket.this_account_is_suspended') if user.locked_at
  else
    errors[:base] << I18n.t('user.not_found')
  end
end