i'm using meta_search on rails 3 app. default (before pressing search button) meta_search returns elements of searching model. , want set 0 result before user pressing search button or if search params blank.
i using meta_search follows:
def index @search = article.search(params[:search]) if params[:search].blank? @places = nil else @places = @search.all end end
what best way set 0 result if search params blank ?
thanks
i don't think that's meta search provides out of box can cheat it.
def index @search = article.search(params[:search].presence || {:id_lt => 0}) @places = @search.all end
Comments
Post a Comment