rails find_by_sql page分页

直接上代码

sql = "select *From hospitals"

@hospital = Hospital.find_by_sql(sql)

@hospital  =  Kaminari.paginate_array(sql ).page(params[:page]).per(20)

@hospital  =  Kaminari.paginate_array(@hospital ).page(params[:page]).per(20)

你可能感兴趣的:(rails,sql,rails)