app/models/activity.rb in muck-activity-0.1.3 vs app/models/activity.rb in muck-activity-0.1.4
- old
+ new
@@ -26,10 +26,10 @@
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 || '%'] } }
+ named_scope :filter_by_template, lambda { |template| { :conditions => ["activities.template = ?", template] } unless template.blank? }
def validate
errors.add_to_base(I18n.t('muck.activities.template_or_item_required')) if template.blank? && item.blank?
end