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

The Archive Base Latest Questions

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

I have 2 models, sessions and presenters with a HABTM relationship between them. On

  • 0

I have 2 models, sessions and presenters with a HABTM relationship between them.
On the create session page, I would like to provide a drop down box from which the user may select multiple presenters for the session.
My code in the _form.html.erb (for sessions) is

<%= f.label :presenters %>

<%= collection_select(:session, :presenters, Presenter.all, :id, :name,{:include_blank => ”},{:multiple => true})%>

However on hitting create I get the following error message on my browser:
Presenter(#2176431740) expected, got String(#2151988680)

The request log shows “presenters”=>[“1″,”2”]

I am guessing that an array of strings containing the ids of the selected presenters is being returned instead of presenter objects. I cannot understand how to get this to work.

(PS- I have created the presenters_sessions table and specified has_and_belongs_to_many in both models)

Thanks in advance.

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

    I you haven’t figured this out, it will work if you pass in :presenter_ids as the second parameter rather than :presenters. In the end, you are just mapping the selected ids to the model’s id collection. The error is saying “You tried to assign a string to a collection of Presenters”.

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

Sidebar

Related Questions

I have two models, A and B, and one light, L. I would like
I have two simple tables in Django which looks like: class Session(models.Model): id =
I have models like this: class IdfPracownicy(models.Model): nazwa = models.CharField(max_length=100) class IdfPracaOpinie(models.Model): nazwa =
I use flask with flask-peewee and wtfpeewee. So, I have models like that: class
I have an existing app that has many, many models. I'd like to log
I currently have a ModelForm set up in Django, but would like to make
I have that situation: I have models Item, Region and Country. class Item(models.Model): name
I have two models in my Django application, for the purposes of storing search
I have 2 models: Video: class Video < ActiveRecord::Base belongs_to :user has_many :thumbnails attr_accessor
I have two models, user and group. I also have a joining table groups_users.

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.