app/models/activity.rb in muck-activity-0.1.2 vs app/models/activity.rb in muck-activity-0.1.3
- old
+ new
@@ -26,10 +26,11 @@
named_scope :since, lambda { |time| {:conditions => ["activities.created_at > ?", time] } }
named_scope :before, lambda {|time| {:conditions => ["activities.created_at < ?", time] } }
named_scope :recent, :order => "activities.created_at DESC"
named_scope :after, lambda {|id| {:conditions => ["activities.id > ?", id] } }
named_scope :only_public, :conditions => ["activities.is_public = true"]
-
+ named_scope :filter_by_template, lambda { |template| {:conditions => ["activities.template = ?", template || '%'] } }
+
def validate
errors.add_to_base(I18n.t('muck.activities.template_or_item_required')) if template.blank? && item.blank?
end
# Provides a template that can be used to render a view of this activity.