我想过滤我的@jobs
使用两个参数。
现在我有这样的事情:
def filter
if params[:filter][:trade].present? && params[:type].present?
@jobs = Job.accepted.with_accepted_company.where(:trade_id => params[:filter][:trade],:job_type =>params[:type])
render :index
elsif params[:filter][:trade].present?
@jobs = Job.accepted.with_accepted_company.where(:trade_id => params[:filter][:trade])
render :index
elsif params[:type].present?
@jobs = Job.accepted.with_accepted_company.where(:job_type =>params[:type])
render :index
else
redirect_to jobs_path
end
end