Permalink
Browse files

updating named_scope to rails 3 scope

  • Loading branch information...
1 parent 2a7a01d commit eef853ec81fc173e822af9d2f029c0a6f03080ab @koonse koonse committed Sep 19, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/tag.rb
View
8 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

0 comments on commit eef853e

Please sign in to comment.