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

  • Home
  • SEARCH
  • 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 8943193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:42:51+00:00 2026-06-15T11:42:51+00:00

I am the following error ActiveRecord::AssociationTypeMismatch in ProposalsController#create User(#78682120) expected, got String(#68929150) Rails.root: /home/james/app

  • 0

I am the following error

ActiveRecord::AssociationTypeMismatch in ProposalsController#create

User(#78682120) expected, got String(#68929150)
Rails.root: /home/james/app

Application Trace | Framework Trace | Full Trace
app/controllers/proposals_controller.rb:76:in `new'
app/controllers/proposals_controller.rb:76:in `create'
Request

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"0qTzQ/KMA2Ch60aajSg265tThfCTBCB7w0rS8nD4Qwg=",
 "proposal"=>{"phones"=>"",
 "broadband"=>"",
 "fixed_line"=>"",
 "group_calling"=>"",
 "frequent_txt"=>"",
 "frequent_data"=>"",
 "type"=>"TelecommunicationsProposal",
 "contact_type"=>"",
 "extra_options"=>"",
 "current_provider"=>"",
 "closing_date"=>"03/12/2012",
 "users"=>["#<User:0x961c9e4>"]},
 "commit"=>"Create Proposal"}

I am trying to have a relationship such that a user has many proposals, and the proposal can have many users.

I have it that I can get the proposals for each user, but need it to be the other way around also.

Proposal.rb

 class Proposal < ActiveRecord::Base
      has_many :users
    ...

TelcommunicationsProposal.rb

class TelecommunicationsProposal < Proposal
  belongs_to :users
  after_create :proposal_creation
  ...

ProposalsController.rb
Error breaks on line 76 which is the Proposal.new creation

 def create
    @proposal = Proposal.new(params[:proposal])

    if current_user
     @user = current_user

Small excerpt from app/views/telecommunications_proposal/_form.html.erb

 <% for user in User.find(:all) %>  
    <div>  
      <%= check_box_tag "proposal[users][]",user%>  
      <%= user.trading_name %>  
    </div>  
<% end %> 

Can someone please show me where I am going 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-06-15T11:42:52+00:00Added an answer on June 15, 2026 at 11:42 am

    Looks like you should be passing the id of the user to check_box_tag, not the record itself, and use user_ids in the name of the checkboxes rather than users:

    <%= check_box_tag "proposal[user_ids][]", user.id %>
    

    Refs:

    • HABTM Checkboxes
    • Methods Added by has_many
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error: ActiveRecord::AssociationTypeMismatch in ContractsController#create ExchangeRate(#2183081860) expected, got HashWithIndifferentAccess(#2159586480) Params: {commit=>Create,
When I try to run the following, I get an error back from ActiveRecord
I'm getting the following error: ActiveRecord::StatementInvalid: PG::Error: ERROR: invalid byte sequence for encoding UTF8:
I have the following three models: class User < ActiveRecord::Base has_many :associations has_many :pharmacies,
I get the following error message when I try to go to my rails
I get following error when running rspec: bundle exec rspec spec/models/user_spec.rb Failures: 1) User
I have got the following models, class City < ActiveRecord::Base belongs_to :state belongs_to :country
Hi (huge Rails newbie here), I have the following models: class Shop < ActiveRecord::Base
I'm trying to create the following query in CI using ActiveRecord SELECT *, (
I'm running a Postgresql query and getting the following error: ActiveRecord::StatementInvalid (PGError: ERROR: could

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.