Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Why rails can't infer foreign key name automatically?
class Child < ActiveRecord::Base
belongs_to :parent # Child has parent_guid field
# ActiveModel::MissingAttributeError:
# can't write unknown attribute `parent_id`
class Parent < ActiveRecord::Base
self.primary_key = 'guid'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment