From eef853ec81fc173e822af9d2f029c0a6f03080ab Mon Sep 17 00:00:00 2001 From: bennyfreshness Date: Sun, 18 Sep 2011 22:29:30 -0700 Subject: [PATCH] updating named_scope to rails 3 scope --- lib/tag.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/tag.rb b/lib/tag.rb index 1e47a7e..ec381e7 100644 --- a/lib/tag.rb +++ b/lib/tag.rb @@ -10,6 +10,10 @@ def find_or_initialize_with_name_like_and_kind(name, kind) validates_presence_of :name validates_uniqueness_of :name, :scope => :kind - named_scope :with_name_like_and_kind, lambda { |name, kind| { :conditions => ["name like ? AND kind = ?", name, kind] } } - named_scope :of_kind, lambda { |kind| { :conditions => {:kind => kind} } } + scope :with_name_like_and_kind, lambda { |name, kind| + where("name like ? AND kind = ?", name, kind) + } + scope :of_kind, lambda { |kind| + where("kind = ?", kind) + } end