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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:31:03+00:00 2026-05-25T14:31:03+00:00

I have a collection_select: <%= form_for(@feedback) do |f| %> <div class=field> <%= f.label :poster_id

  • 0

I have a collection_select:

<%= form_for(@feedback) do |f| %>

<div class="field">
<%= f.label :poster_id %><br />
<%= f.collection_select :feedback, :poster_id, @users, :id, @user.username, :prompt => "Select your username" %><br />
<%= f.number_field :poster_id %>
</div>
<% end %>

This is the error message:

ActionView::Template::Error (undefined method `merge' for "test":String):
    15:     
    16:   <div class="field">
    17:     <%= f.label :poster_id %><br />
    18:     <%= f.collection_select :feedback, :poster_id, @users, :id, @user.username %><br />
    19:     <%= f.number_field :poster_id %>
    20:   </div>
    21:   <div class="field">
  app/views/feedbacks/_form.html.erb:18:in `block in _app_views_feedbacks__form_html_erb__3181571289116259961_2154876620'
  app/views/feedbacks/_form.html.erb:3:in `_app_views_feedbacks__form_html_erb__3181571289116259961_2154876620'

“test” is the username that was returned by @user.username.

How do I fix that?

  • 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-25T14:31:04+00:00Added an answer on May 25, 2026 at 2:31 pm

    the signature for collection_select is:

    def collection_select method, collection, value_method, text_method, options = {}, html_options = {}
    

    i’m not sure what you’re trying to do, maybe this is what you want:

    <%= f.collection_select :poster_id, @users, :id, :username, :prompt => "Select your username" %><br />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code inside the _forms view. <div class=field> Shop: <%= f.collection_select
I have a form field where a user enters contact information, including name, email,
I have a FinancialDocument#document_type model attribute. I'd like to let the user select the
I have 3 model the first user.rb: class User has_many :boards, dependent: :destroy has_many
I have this form: <%= form_for(@post) do |f| %> <%=f.collection_select :post_id, Board.where(:user_id => current_user.id),
I have a collection of classes that inherit from an abstract class I created.
I have created the following select using the option_groups_from_collection_for_select form helper in Rails as
I have 2 models The first model category.rb class Category include Mongoid::Document # Relationships
I have 2 models: board.rb class Board has_and_belongs_to_many :posts, :autosave => true end post.rb
I have a Timesheet model, a Run model, and an Athlete model. class Timesheet

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.