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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:41:33+00:00 2026-06-16T01:41:33+00:00

I have a model Event and a model Serie. They are defined like this:

  • 0

I have a model Event and a model Serie.
They are defined like this:

in event.rb

belongs_to :serie
accepts_nested_attributes_for :serie
attr_accessible :serie

in serie.rb

has_many :events

Event table has the serie_id key.

In the event form I have pretty much the following:

 form_for @event do |f|
   ...
   ...
   f.fields_for @event.serie do |serie_f|
     ....
   end
 end

The request to the controller is coming like this:

... "event"=>{...., "serie"=>{"..."=>"19/12/2012", ....}, ...}...

In the create action of events_controller I have:

def create
  @event = current_user.events.new(params[:event])
  ....

In this line I get the following error:

ActiveRecord::AssociationTypeMismatch (Serie(#134112340) expected, got ActiveSupport::HashWithIndifferentAccess(#92663620))

Unsure what the problem is

  • 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-16T01:41:36+00:00Added an answer on June 16, 2026 at 1:41 am

    You should check this question : ActiveRecord::AssociationTypeMismatch when attempting to save nested attributes in Rails.
    I think that you simply have to replace attr_accessible :serie by attr_accessible :serie_attributes in your model.
    And in your view, try f.fields_for :serie do |serie_f| instead of f.fields_for @event.serie do |serie_f|

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

Sidebar

Related Questions

I have a model that looks like this: Performance - Location - Event -
I have a model that looks like this: class Invite(models.Model): user = models.ForeignKey(User) event
Here is my question. I have this model one [Event] has multiple [Day] and
I would like to have one model (event) that has multiple polymorphic HABTM associations
I have a model called Event and another called Product. An event has many
I have this model var Item = Backbone.Model.extend({ url: 'http://localhost/InterprisePOS/Product/loaditembycategory/Event Materials' }); var onSuccess
I have a model Events and each event contains an array of ids for
So, I have an Event model that has a starts_at and a ends_at column
I have two model objects: Event Venue Events have Venues. Venues can have 1..*
I have a model for Event that I would like to have a user

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.