app/models/event.rb in artfully_ose-1.2.0.pre.27 vs app/models/event.rb in artfully_ose-1.2.0

- old
+ new

@@ -8,12 +8,13 @@ CATEGORIES = ["Dance", "Film & Electronic Media", "Literary Arts", "Music", "Theater", "Visual Arts", "Other"] attr_accessible :name, :producer, :description, :contact_email, :contact_phone, :image, :venue_attributes, :show_special_instructions, :special_instructions_caption, :public, :primary_category, - :secondary_categories, :primary_category_other, :secondary_category_other, :members_only - + :secondary_categories, :primary_category_other, :secondary_category_other, :members_only, + :subtitle + store :cached_stats, :accessors => [ :on_sale, :off_sale, :sold, :sales_total ] belongs_to :organization belongs_to :venue belongs_to :import @@ -26,10 +27,11 @@ has_many :pass_types, :through => :events_pass_types validate :validate_contact_phone validates :contact_email, :presence => true, :email => true validates :name, :presence => true validates :organization_id, :presence => true + validate :subtitle, length: { maximum: 255 } has_attached_file :image, :storage => :s3, :path => ":attachment/:id/:style.:extension", :bucket => Rails.configuration.s3.bucket, @@ -57,12 +59,18 @@ delegate :time_zone, :to => :venue ANY_EVENT_TEXT = "(Any Event)" ANY_EVENT_ID = "-1" + searchable do + text :name + end + include Ext::DelayedIndexing + # # Run synchronously only with great care. # + def refresh_stats self.on_sale = self.glance.available.on_sale self.off_sale = self.glance.available.off_sale self.sold = self.glance.sold.total self.sales_total = self.glance.sales.total