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

时间:2014-01-10 14:15:57

标签: ruby-on-rails views 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 %>

用户控制器

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

1 个答案:

答案 0 :(得分:9)

<%= if current_user.activities.include?(event.activity) %>

<% if current_user.activities.include?(event.activity) %>