我有我的自定义演示者
class ShiftPresenter
def initialize(shift, template)
@shift = shift
@template = template
end
def h
@template
end
def users_list
logs = ShiftLog.by_shift(@shift)
names = logs.map do |log|
log.cardiologist.name
end
h.content_tag :div, names unless names.empty?
end
end
并#index
查看
- present shift do |shift_presenter|
= shift_presenter.user_list
如何使用li
而不是 ['tom', 'jerry']来显示用户名