*MySQLのLIKE検索
xxx.rb
User.where("name like?","%sato%")
*既存の別配列からの検索
xxx.rb
Topic.where("id in (?) or user_id in (?)", topic_id_list, user_id_list)
*null以外の検索
xxx.rb
Topic.where("user_id IS NOT NULL")
*日付を指定したの検索(3日前~5日前の場合)
xxx.rb
t1 = Time.now - 5.day
t2 = Time.now - 3.day
Topic.where(["created_at >= ? AND created_at <= ? " , t1 , t2])