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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:23:32+00:00 2026-05-29T23:23:32+00:00

Summary: I am pulling a list of user IDs from a members transaction table

  • 0

Summary: I am pulling a list of user IDs from a members transaction table that is then used to generate a list of users from the database. This is then used to generate JSON sent to a page that lists users associated with an account.

Background: Scala code using Squeryl on Play! Framework

The Error: value id is not a member of Option[models.User] when mapping the users to the JSON generator

The Code: Here’s code being used in succession to finally generate the JSON

def memberIds(accountId: Long) = { from(DB.members)(m =>
      where(m.accountId === accountId)
        select (m)).map(_.userId).toSet
  }

def membersToAccount(id: Long) = {
    memberIds(id).map( i => models.User.get(i))
  }

def listMembers(accountId: Long) = {
    Json(generate(Account.membersToAccount(accountId)
      .map(user => Map(
      "id" -> user.id,
      "name" -> user.name,
      "username" -> user.username
    ))))
  }

The Confusion: the User class contains an id val that looks like case class User(
val id: Long, etc.
I’m confused as to why it would create this error. Is it a problem with syntax or where I am mapping the users? Thanks!

  • 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-29T23:23:33+00:00Added an answer on May 29, 2026 at 11:23 pm

    That’s cause models.User is wrapped in Option container (actually, that is monad). It’s like trying to call method of User directly on List of users, like: List(someUsers).id

    Basically that means, that this value can be either Some (non null wrapper) or Nothing (just like null but better).

    Moreover, it is better not to use get on Options, consider link above for details.

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

Sidebar

Related Questions

Summary: I want to to create a templateField resulting from a database after calling
I'm pulling the top 15 locations from the database by sorting based on the
Summary We have an ASP.NET application that allows users to query a SQL Server
When viewing this url http://dl.dropbox.com/u/1550420/jquery/flickr.html , we see a list of images pulling from
Summary How can you make ant repeatedly generate byte-identical jar files from the same
Summary What's the best way to ensure a table cell cannot be less than
Summary: web page has a few fields to allow the user to enter payments.
Summary I'm repurposing Apple's Page Control project. In loadScrollViewWithPage:, the view controllers that I'm
Summary: ASP.Net website with a couple hundred users. Data is exported to Excel files
Summary: exporting pixel data from NSOpenGLView to some file formats gives incorrect colours I

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.