end of day commit
This commit is contained in:
@@ -10,6 +10,9 @@ class Supplier
|
||||
has_many :tables, dependent: :destroy
|
||||
#has_many :lists, through: :tables
|
||||
has_many :orders
|
||||
has_many :sections, dependent: :destroy
|
||||
|
||||
after_create :add_section_on_create
|
||||
|
||||
def active_orders
|
||||
return @active_orders if @active_orders
|
||||
@@ -31,4 +34,14 @@ class Supplier
|
||||
tables
|
||||
end
|
||||
|
||||
def non_placed_tables
|
||||
tables.reject{|t| t.section_id.present? }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_section_on_create
|
||||
@section = Section.create supplier: self, title: I18n.t('section.first_section_title')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user