app/models/effective/region.rb in effective_regions-1.8.6 vs app/models/effective/region.rb in effective_regions-1.9.0

- old
+ new

@@ -2,23 +2,24 @@ class Region < ActiveRecord::Base self.table_name = EffectiveRegions.regions_table_name.to_s belongs_to :regionable, polymorphic: true, optional: true - # structure do - # title :string - # content :text - # snippets :text - # timestamps - # end + effective_resource do + title :string + content :text + snippets :text + timestamps + end + serialize :snippets, HashWithIndifferentAccess scope :global, -> { where("#{EffectiveRegions.regions_table_name}.regionable_type IS NULL").where("#{EffectiveRegions.regions_table_name}.regionable_id IS NULL") } scope :with_snippets, -> { where("#{EffectiveRegions.regions_table_name}.snippets ILIKE ?", '%snippet_%') } - validates_presence_of :title + validates :title, presence: true def snippets self[:snippets] || HashWithIndifferentAccess.new() end @@ -39,9 +40,5 @@ regionable_id == nil && regionable_type == nil end end end - - - -