这个错误涉及什么?我无法弄清楚代码在哪里不正确?
用户 Index.html.erb
<%= @events.all.each do |event| %>
<%= if current_user.activities.include?(event.activity) %>
<%= event.activity %>
<%= event.description %>
<%= event.start_time %>
<%= event.end_time %>
<%= event.num_attendees_requested %>
<%= event.location_name %>
<%= event.street_address %>
<%= event.city %>
<%= event.state %>
<% end %>
<% end %>
用户控制器
class UsersController < ApplicationController
def index
@users = User.all
@activities = Activity.all
@events = Event.all
end
def show
@user = current_user
@events = Event.all
@activities = Activity.all
end
答案 0 :(得分:9)
<%= if current_user.activities.include?(event.activity) %>
到
<% if current_user.activities.include?(event.activity) %>