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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:27:59+00:00 2026-05-23T11:27:59+00:00

I have a error with page updating ActiveRecord::AssociationTypeMismatch in Admin::PagesController#update Page(#64407864) expected, got String(#17069256)

  • 0

I have a error with page updating

ActiveRecord::AssociationTypeMismatch in Admin::PagesController#update
Page(#64407864) expected, got String(#17069256)
app/controllers/admin/pages_controller.rb:36:in `update’

line 36 of Admin::PagesController update

   if @page.update_attributes(params[:page])

page.rb

class Page < ActiveRecord::Base

  has_and_belongs_to_many :related, :class_name => "Page", :join_table => "pages_related", :foreign_key => "page_id", :association_foreign_key => "related_id"

end

_form.html.erb

    <%= f.select :related, Page.all.delete_if {|p| p.id == f.object.id}.collect {|p| [p.title, p.id]}, { :include_blank => true }, {:multiple => "multiple"} %>

up:


thanks, its working, but now Ive got the error with new Page creating

Called id for nil, which would
mistakenly be 4 — if you really
wanted the id of nil, use object_id

Extracted source (around line #70):

70: <%= f.select :related_ids,
Page.all.delete_if {|p| p.id ==
f.object.id}.collect {|p| [p.title,
p.id]}, { :include_blank => true },
{:multiple => “multiple”, :class =>
“select_multiple”} %>

  • 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-23T11:28:00+00:00Added an answer on May 23, 2026 at 11:28 am

    Your select field should be called related_ids, since it will be passing back the IDs for the selected objects, not the actual objects themselves.

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

Sidebar

Related Questions

I have a custom error page set up for my application: <customErrors mode=On defaultRedirect=~/errors/GeneralError.aspx
I have an application web.xml with the following entry: <error-page> <error-code>404</error-code> <location>/system_files/error/p_notfound.jsp</location> </error-page> However,
I have a page called Error.php. Variables are usually passed to it using the
I have a page called ..hi i get this error when visiting the page.
I have a few labels on my page with a class of 'error', the
I have a multi-lingual page where I want to display form validation error in
I have an error handling method in my ApplicationController: rescue_from ActiveRecord::RecordNotFound, :with => :not_found
I have a Update Panel and other controls in my ASPX page. After user
I have a PHP update page in which I am showing a text field
I have a Rails 3 app that uses a remote/AJAX link to update a

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.