My favorites
▼
|
Sign in
substruct
Open-source Ruby on Rails E-Commerce
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
12
attachment: item.rb
(1.1 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# This is the base model for Product and ProductVariation.
#
#
class Item < ActiveRecord::Base
has_many :order_line_items
has_many :wishlist_items, :dependent => :destroy
validates_presence_of :name, :code
validates_uniqueness_of :code
#############################################################################
# CALLBACKS
#############################################################################
# DB complains if there's not a date available set.
# This is a cheap fix.
before_save :set_date_available
def set_date_available
self.date_available = Date.today if !self.date_available
end
#############################################################################
# CLASS METHODS
#############################################################################
#############################################################################
# INSTANCE METHODS
#############################################################################
# Name output for product suggestion JS
#
def suggestion_name
"#{self.code}: #{self.name}"
end
end
Powered by
Google Project Hosting