Added :meals and :compositions_ingredients tables
Changed Column -> QuantityColumn Updated :ingredients table to handle recipes
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
class Ingredient < ActiveRecord::Base
|
||||
enum group: {
|
||||
other: 0,
|
||||
meat: 1
|
||||
dish: 1,
|
||||
recipe: 2,
|
||||
meat: 3
|
||||
}
|
||||
|
||||
# Has to go before any 'dependent:' association
|
||||
|
||||
@@ -3,9 +3,9 @@ class MeasurementRoutine < ActiveRecord::Base
|
||||
has_many :measurements, -> { order "taken_at DESC" }, inverse_of: :routine,
|
||||
foreign_key: 'routine_id', dependent: :restrict_with_error,
|
||||
extend: BodyTracking::ItemsWithQuantities
|
||||
has_many :columns, as: :column_view, dependent: :destroy,
|
||||
extend: BodyTracking::TogglableColumns
|
||||
has_many :quantities, -> { order "lft" }, through: :columns
|
||||
has_many :readout_columns, as: :column_view, dependent: :destroy,
|
||||
class: 'QuantityColumn', extend: BodyTracking::TogglableColumns
|
||||
has_many :quantities, -> { order "lft" }, through: :readout_columns
|
||||
|
||||
validates :name, presence: true, uniqueness: {scope: :project_id}
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Column < ActiveRecord::Base
|
||||
class QuantityColumn < ActiveRecord::Base
|
||||
belongs_to :column_view, polymorphic: true
|
||||
belongs_to :quantity
|
||||
end
|
||||
Reference in New Issue
Block a user