Class: ShopDiscount

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/shop_discount.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_including_invalid(*attrs) ⇒ Object

This will override the default scope



30
31
32
# File 'app/models/shop_discount.rb', line 30

def self.all_including_invalid(*attrs)
  with_exclusive_scope{find(:all,*attrs)}
end

Instance Method Details

#available_categoriesObject

Return all categories minus its own



35
36
37
# File 'app/models/shop_discount.rb', line 35

def available_categories
  ShopCategory.all - categories
end

#available_productsObject

Returns all products minus its own



40
41
42
# File 'app/models/shop_discount.rb', line 40

def available_products
  ShopProduct.all - products
end

#available_usersObject



44
45
46
# File 'app/models/shop_discount.rb', line 44

def available_users
  User.all - users
end