我有以下控制器方法
def app_used_by_Lab
per_id = params[:id]
@search1 = Apparatus.used_by_specific_lab(per_id).search(params[:search]) # both 'used_by_specific_lab' & 'lab_created' are named_scopes which return results from the same table
@search2 = Apparatus.lab_created(per_id).search(params[:search])
@search = @search2 + @search1
@search.order ||= :descend_by_RPR_DATE_CREATED
@apparatuses = @search.paginate(:page => params[:page], :per_page => 10)
end
如果我将代码更改为 '@search = @search1'
,它可以正常工作并返回结果,但是当我这样做时'@search = @search2 + @search1'
,我会收到以下错误消息:
TypeError in ApparatusesController#app_used_by_Lab
can't convert Searchlogic::Search into Array
不能在数组上使用 searchlogic 吗?
有没有解决上述问题的方法?
非常感谢您的宝贵帮助。