app/models/effective/region.rb in effective_regions-1.6.3 vs app/models/effective/region.rb in effective_regions-1.6.4
- old
+ new
@@ -2,21 +2,22 @@
class Region < ActiveRecord::Base
self.table_name = EffectiveRegions.regions_table_name.to_s
belongs_to :regionable, :polymorphic => true
- structure do
- title :string, :validates => [:presence]
- content :text
- snippets :text
+ # structure do
+ # title :string
+ # content :text
+ # snippets :text
+ # timestamps
+ # end
- 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
def snippets
self[:snippets] || HashWithIndifferentAccess.new()
end