class Anketum < ActiveRecord::Base
has_one :user
class << self
def search(params)
self.scope :h, :conditions => {:height => params[:height]}
#scope :w, :conditions => {:width => params[:width]}
self.h if params[:height]
end
end
end
I need to create multiple scope depend on params[:xxx] present
Judging by your code sample, you’re way over-engineering this:
Your models should never access the
paramshash, by the way.