fix regression where viewing a page for a single tag (like starred) did not work

and fix some test warnings/errors
This commit is contained in:
Reinier Balt 2011-10-31 14:39:52 +01:00
parent 67d574bf73
commit cda75a0cc1
5 changed files with 19 additions and 14 deletions

View file

@ -38,7 +38,7 @@ class Todo < ActiveRecord::Base
# other scopes
named_scope :are_due, :conditions => ['NOT (todos.due IS NULL)']
named_scope :with_tag, lambda { |tag| {:joins => :taggings, :conditions => ["taggings.tag_id = ? ", tag.id] } }
named_scope :with_tag, lambda { |tag_id| {:joins => :taggings, :conditions => ["taggings.tag_id = ? ", tag_id] } }
named_scope :with_tags, lambda { |tag_ids| {:conditions => ["EXISTS(SELECT * from taggings t WHERE t.tag_id IN (?) AND t.taggable_id=todos.id AND t.taggable_type='Todo')", tag_ids] } }
named_scope :of_user, lambda { |user_id| {:conditions => ["todos.user_id = ? ", user_id] } }
named_scope :completed_after, lambda { |date| {:conditions => ["todos.completed_at > ? ", date] } }