I got two models:
Extension and User. User has a foreign key called extension_id.
Extension has not key to user since it can be used by various models.
My user model has “has_one :extension”
Why do the following code fail?
@user = User.find(params[:id])
PGError: ERROR: column extensions.user_id does not exist
RAD 1: SELECT * FROM extensions WHERE (extensions.user_id = 1) LIM…
: SELECT * FROM extensions WHERE (extensions.user_id = 1) LIMIT 1
I do not understand why extension have to have a user_id? Can’t
relations be one way?