Module: ColumnsOnDemand::ClassMethods

Defined in:
lib/columns_on_demand.rb

Instance Method Summary collapse

Instance Method Details

#default_select(qualified) ⇒ Object

this is the method API as called by ActiveRecord 2.x. we also call it ourselves above in our ActiveRecord 3 extensions.



31
32
33
34
35
36
37
38
# File 'lib/columns_on_demand.rb', line 31

def default_select(qualified)
  @columns_to_select ||= (columns.collect(&:name) - columns_to_load_on_demand).collect {|attr_name| connection.quote_column_name(attr_name)}
  if qualified
    quoted_table_name + '.' + @columns_to_select.join(", #{quoted_table_name}.")
  else
    @columns_to_select.join(", ")
  end
end