Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6576811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:33:30+00:00 2026-05-25T15:33:30+00:00

This is going to be a really dumb question, and I almost hate myself

  • 0

This is going to be a really dumb question, and I almost hate myself for asking it, but here goes.

When I run my Cucumber test, I’m getting a “syntax error, unexpected ‘)'” with the following code:

inside my user model:

def member?(gallery)
    array = []
    self.groups.each do |group|
        array << group.id
    end
    if array.include?(gallery.group.id)
        true
    end
end

And in my view:

<ul>
<% @galleries.each do |gallery| %>
    <% if current_user.member?(gallery) %>
    <li>
        <%= link_to gallery.title, gallery %>
    </li>
    <% end %>
<% end %>
</ul>

EDIT: Here is the important part of the error in full:

 ~/Coding/Rails/galleryTest/app/views/galleries/index.html.erb:8: syntax error, unexpected     ')', expecting keyword_then or ';' or '\n'
  ... current_user.member? gallery );@output_buffer.safe_concat('
  ...                               ^
  ~/Coding/Rails/galleryTest/app/views/galleries/index.html.erb:13: syntax error, unexpected keyword_end, expecting ')'
  ');    end 
            ^

EDIT 2: Here is the error when removing the ‘=’:

Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id (ActionView::Template::Error)
  ./app/models/user.rb:18:in `member?'

I have tried a few different things, and I’ve got to be missing something really trivial. Another pair of eyes would be greatly appreciated.

Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:33:30+00:00Added an answer on May 25, 2026 at 3:33 pm
    <%= if current_user.member?(gallery) %>
    

    should be:

    <% if current_user.member?(gallery) %>
    

    Not that there is no =, it means output and your code is trying to output the response of the if block.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is going to be a really dumb question, I just know it, but
Okay this is going to seem really dumb but bear with me please. A
I am sure this is something really simple, but I am going bonkers trying
This is going to sound like a silly question, but I'm still learning C,
Okay, the question might seem dumb, but I'm asking it anyways. After struggling for
This is going to sound really ghetto, but I need to print some Javascript
This is going to be quite a vague question but I am wondering how
I'm sorry if this comes through as a noob question, but I'm really stuck
This is going to be a question really for someone who has knowledge with
Probably a dumb question, but can you write a unit test project in one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.