语法错误,意外')',期待keyword_then或';' 或'\n'

Joh*_*ohn 2 views ruby-on-rails controllers

这个错误涉及什么?我无法弄清楚代码在哪里不正确?

用户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 %>
Run Code Online (Sandbox Code Playgroud)

用户控制器

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
Run Code Online (Sandbox Code Playgroud)

Nit*_*hin 9

<%= if current_user.activities.include?(event.activity) %>
Run Code Online (Sandbox Code Playgroud)

<% if current_user.activities.include?(event.activity) %>
Run Code Online (Sandbox Code Playgroud)