Class: CommaHeaven::Sqler::HasOneColumns

Inherits:
AssociationColumns show all
Defined in:
lib/comma-heaven/sqler/has_one_columns.rb

Instance Attribute Summary

Attributes inherited from AssociationColumns

#association, #position

Attributes inherited from Columns

#index, #model, #options, #parent

Instance Method Summary collapse

Methods inherited from AssociationColumns

#foreign_key_for, #initialize, #prefix, #table_alias

Methods inherited from Columns

#initialize, #joins, #prefix, #select, #sql_as, #table, #table_alias

Constructor Details

This class inherits a constructor from CommaHeaven::Sqler::AssociationColumns

Instance Method Details

#join_clauseObject



4
5
6
7
8
9
# File 'lib/comma-heaven/sqler/has_one_columns.rb', line 4

def join_clause
  <<-EOS
  LEFT JOIN #{quote(table)} AS #{table_alias}
    ON #{parent.table_alias}.#{model.primary_key} = #{table_alias}.#{foreign_key_for(association)}
  EOS
end