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 5951637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:33:58+00:00 2026-05-22T17:33:58+00:00

UPDATED WITH SOLUTION FROM BELOW PRODUCES NEW ERROR. Users invite others to review their

  • 0

UPDATED WITH SOLUTION FROM BELOW PRODUCES NEW ERROR.

Users invite others to review their work. To track this, the invitations table has reviewer_id and reviewee_id fields. The model contains:

belongs_to :user
has_many :users

To display all invitations for a user we first get all the invitations:

@invitations = Invitation.where("reviewee_id = ?", current_user.id ).select(:reviewer_id).order("updated_at")

Then we get all the users who were invited: (this part is wrong)

@reviewers = []
@invitations.each do |i|
  @reviewers << User.where("id = ?", i.reviewer_id )
end

This current solution produces the following:

undefined method `first_name' for []:ActiveRecord::Relation

I did a test with the following code to see what is in @reviewers:

<% @reviewers.each do |r| %>
   <%= r.id %><br>
<% end %>

Instead of returning the ids it returned:

2173491700
2173491200
2173490540

So the array is not getting populated appropriately.

I am grateful for your help and most grateful for specific code.

  • 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-22T17:33:58+00:00Added an answer on May 22, 2026 at 5:33 pm

    You want to gather up all the IDs then pass them to where.

    reviewer_ids = @invitations.collect { |i| i.reviewer_id }
    @reviewers = User.where(:id => reviewer_ids)
    

    This grabs all the reviewers in a single database call.

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

Sidebar

Related Questions

UPDATED I used below solutions (loading Image from stream), but get new problem. img
NOTE: I added my new solution at the UPDATE answer below. I try to
Updated question, see below I'm starting a new project and I would like to
Update I have posted my solution to this problem as an answer below. It
Here's my error. dyld: Symbol not found: __ZTIN8eqOsirix3ROIE Referenced from: /Users/slate/Documents/osirixplugins/CoreDataTrial_EQOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix Expected in: flat
Update: We are still using XP at work and I got my solution working,
Update: This question was an epic failure, but here's the working solution. It's based
UPDATE As Mathias notes below, this exact problem has been reported and resolved here:
Note: A possible solution needs only work in Firefox 3.0, my app doesn't allow
NOTE: I have updated this since originally asking the question to reflect some of

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.