Mark Simoneau

Results 3 comments of Mark Simoneau

Are these two errors in fact the same? One points to the "wrong" alias (suggesting profile_establishments) and one points to a missing alias altogether. Hrm.

**Workaround** Specify the join alias in the _other_ queries. It appears that in the "enabled" query, Rails/ActiveRelation picks a different table alias if the table is already joined, making the...

This is because establishment is a has_one, not belongs_to relationship to profile. It should be ``` scope :enabled, joins("INNER JOIN profiles as p01 ON p01.establishment_id = establishments.id"). where("po1.enabled IS true")...