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 online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
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)