当我尝试渲染列表分页作业时,尽管包含了所有这些项目的数组。发生了什么事? http://take.ms/9HtCa
jobs_controller.rb
def index
@joblist = Job.page(params[:page]).per(20)
render 'jobs/index'
end
index.html.haml
.row-fluid
.span8.hidden-desktop
=render 'job'
.span4
.center
.add-job
=link_to "добавить вакансию", new_job_path
_job.html.haml
%span
=@joblist.each do |job|
%ul
.job-item
%span
.fl-l
=job.title
.fl-r
=succeed ',' do
=Country.find_by_id(job.country_id).name
=City.find_by_id(job.city_id).name
%br
%span
.fl-l
=job.jobtype
%br
=paginate @joblist
答案 0 :(得分:1)
在=
之前移除@joblist.each
。它显示由表达式返回的值,每个都返回它迭代的数组。
答案 1 :(得分:1)