added filter criteria models

This commit is contained in:
Edin Dazdarevic
2015-02-07 14:48:02 +01:00
parent 0bb6bb5a49
commit ead0e87e31
25 changed files with 240 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
class Category < ActiveRecord::Base
has_many :sub_categories
has_many :filter_criterias, as: :owner
belongs_to :section
end

View 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

View File

@@ -0,0 +1,3 @@
class FilterCriteriaValue < ActiveRecord::Base
belongs_to :filter_criteria
end

View File

@@ -1,3 +1,4 @@
class Section < ActiveRecord::Base
has_many :categories
has_many :filter_criterias, as: :owner
end

View File

@@ -1,5 +1,6 @@
class SubCategory < ActiveRecord::Base
belongs_to :category
has_many :filter_criterias, as: :owner
end