活动管理员仪表板
ActiveAdmin.register_page "Dashboard" do
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
content :title => proc{ I18n.t("active_admin.dashboard") } do
section h2 "Top Movie" do
table_for @top_ps.where('ptype = ?', 'movie') do |t|
column("Title"){|p| link_to p.title, admin_program_path(p.id)}
column "Start" do |p|
p.program_schedules.each do |schedule|
link_to distance_of_time_in_words(Time.now, schedule.start,true), admin_program_schedule_path(schedule.id)
end
end
end
end
end # content
end
如果我运行这个我得到
[#<ProgramSchedule id: 746, program_id: 430, start: "2012-09-17 09:30:00", stop: "2012-09-17 10:30:00">,
#<ProgramSchedule id: 8124, program_id: 430, start: "2012-09-22 23:30:00", stop: "2012-09-23 00:30:00">]
代替
<a href="/path">Start</a>
<a href="/path">Start</a>
我知道我错在哪里,但是如何在块内执行该代码?