end of day commit

This commit is contained in:
2012-08-28 20:08:13 +02:00
parent 0b16614d41
commit 89700f36e9
43 changed files with 896 additions and 26 deletions
+10
View File
@@ -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