Read more

Fix when assigning nested attributes raises "undefined method `to_sym' for nil:NilClass"

Henning Koch
March 05, 2014Software engineer at makandra GmbH

You might have a table without a primary key set in MySQL.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

You can fix this by adding a primary key index to the guilty MySQL table, or by setting self.primary_key = "id" in your class definition.

Related, but different issue: Rails 2 does not find an association when it is named with a string instead of a symbol

Posted by Henning Koch to makandra dev (2014-03-05 15:29)