added constraint for fav search

This commit is contained in:
albert
2011-11-16 13:12:02 -05:00
parent 710d584ec6
commit cce3fe0b64
10 changed files with 4 additions and 96 deletions

View File

@@ -1,4 +1,4 @@
class Favorite < ActiveRecord::Base
belongs_to :post
scope :for_user, lambda {|user_id| where("user_id = #{user_id}")}
scope :for_user, lambda {|user_id| where("user_id % 100 = #{user_id.to_i % 100} and user_id = #{user_id.to_i}")}
end