added filter criteria models
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
class Category < ActiveRecord::Base
|
||||
has_many :sub_categories
|
||||
has_many :filter_criterias, as: :owner
|
||||
belongs_to :section
|
||||
end
|
||||
|
||||
9
front-api/models/filter_criteria.rb
Normal file
9
front-api/models/filter_criteria.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class FilterCriteria < ActiveRecord::Base
|
||||
has_many :filter_criteria_values
|
||||
belongs_to :owner, polymorphic: true
|
||||
|
||||
self.inheritance_column = :_type_disabled
|
||||
def owner_type=(class_name)
|
||||
super(class_name.constantize.base_class.to_s)
|
||||
end
|
||||
end
|
||||
3
front-api/models/filter_criteria_value.rb
Normal file
3
front-api/models/filter_criteria_value.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class FilterCriteriaValue < ActiveRecord::Base
|
||||
belongs_to :filter_criteria
|
||||
end
|
||||
@@ -1,3 +1,4 @@
|
||||
class Section < ActiveRecord::Base
|
||||
has_many :categories
|
||||
has_many :filter_criterias, as: :owner
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class SubCategory < ActiveRecord::Base
|
||||
belongs_to :category
|
||||
has_many :filter_criterias, as: :owner
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user