PG::UndefinedColumn: ERROR: column comments.status_id does not exist
LINE 1: SELECT “comments”.* FROM “comments” WHERE “comments”.“status_id”
I’m assuming when the above call is constructed by rails it is assuming
the table statuses has primary key status.id by convention…
All it does is taking the model name and suffix it with _id. Specifying
:foreign_key option should work.
:foreign_key
Specify the foreign key used for the association. By default this is
guessed to be the name of this class in lower-case and “_id”
suffixed. So a Person class that makes a has_and_belongs_to_many
association to Project will use “person_id” as the default
:foreign_key.