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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:12:50+00:00 2026-05-23T08:12:50+00:00

So over the last 2 hours, I’ve been trying to fill a combobox with

  • 0

So over the last 2 hours, I’ve been trying to fill a combobox with all my users. I managed to get all firstnames in a combobox, but I want their full name in the combobox. No problem you would think, just concatenate the names and you’re done. + and << should be the concatenation operator to do this.So this is my code:

<%= collection_select(:user, :user_id, @users, :user_id, :user_firstname + :user_lastname, {:prompt => false}) %>

But it seems RoR doesn’t accept this:

undefined method `+' for :user_firstname:Symbol

What am I doing wrong?

  • 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-23T08:12:51+00:00Added an answer on May 23, 2026 at 8:12 am

    What you need to do is define a method on the User model that does this concatenation for you. Symbols can’t be concatenated. So to your user model, add this function:

    def name
      "#{self.first_name} #{self.last_name}"
    end
    

    then change the code in the view to this:

    <%= collection_select(:user, :user_id, @users, :user_id, :name, {:prompt => false}) %>
    

    Should do the trick.

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

Sidebar

Related Questions

I've been trying over the last few hours to implement a jQuery easing effect
I have been trying to learn python over the last couple of months and
I've been pulling my hair out for the last few hours trying to wrestle
've been puzzling over cronjobs for the last few hours. I've read documentation and
I'm very experienced in C/C++/Objective-C and over the last few days have been trying
Over the course of the last couple of hours I have been tracking down
I've spent several hours over the past few days trying to get PostgreSQL to
So I just spent the last few hours pouring over code trying to figure
Over the last few weeks I have been studying the MVC design pattern for
I've been teaching myself Dojo over the last few days. However, if you look

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.