working ember... again

This commit is contained in:
2013-10-07 23:00:01 +02:00
parent a8c01d264e
commit 2f41560591
46 changed files with 274 additions and 114 deletions
+12 -1
View File
@@ -12,7 +12,7 @@ class Table
has_many :lists
attr_protected :supplier_id
attr_accessor :active_list_id
attr_accessor :active_list_id, :active_list
validates :supplier_id, presence: true
#validates :list_id, presence: true
@@ -68,9 +68,20 @@ class Table
end
def active_list
# nil memoizing
return @active_list if @active_list_is_set
@active_list ||= self.class.database.view(List.active_by_table_id_view(key: id, include_docs: true, reduce: false, limit: 1)).try(:first)
end
def active_list=(val)
@active_list_is_set = true
@active_list = val
end
def active_list_id
@active_list_id || active_list.try(:id)
end
def reserved?
false
end