不知道我是否以正确的方式进行,但我在我的模型中有以下内容,并希望在我的视图中呈现它(即显示左侧打开的学生空间的数量)如何在我的视图中渲染我定义的模型?
型号:
def open_student_spots
event.student_rsvp_limit - event.student_rsvps_count
end
这是我想在我的意见显示,这里的面积就是我做了(虽然不正确,到目前为止)
<i class='fa fa-user'></i>Spaces Available: <%=
<% if event.students_at_limit? %>
(<%= event.student_waitlist_rsvps_count %> Waitlisted)
<% else %>
<% open_student_spots %> #how to fix this line?
</div>
<% end %>
我怎样才能使这项工作吗?
我有一个感觉,这是错误的'event.student_rsvp_limit - event.student_rsvps_count'。 – Pavan