end of day commit
This commit is contained in:
@@ -2,13 +2,19 @@ class Table
|
||||
include SimplyStored::Couch
|
||||
|
||||
property :number, type: Fixnum, default: 1
|
||||
property :position_x, type: Float
|
||||
property :position_y, type: Float
|
||||
|
||||
belongs_to :supplier
|
||||
belongs_to :section
|
||||
has_many :lists
|
||||
|
||||
attr_protected :supplier_id
|
||||
|
||||
validates :supplier_id, presence: true
|
||||
#validates :list_id, presence: true
|
||||
validates :number, numericality: {greater_than: 0}
|
||||
validates_uniqueness_of :number
|
||||
|
||||
view :active_lists, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active'){
|
||||
@@ -20,4 +26,8 @@ class Table
|
||||
not self.class.database.view(self.class.active_lists(key: id, reduce: true)).zero?
|
||||
end
|
||||
|
||||
def name
|
||||
number
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user