module ColumnsOnDemand::ClassMethods

Public Instance Methods

columns_to_load_by_default() click to toggle source
# File lib/columns_on_demand.rb, line 40
def columns_to_load_by_default
  @columns_to_load_by_default ||= Set.new(columns.collect(&:name) - columns_to_load_on_demand)
end
default_select(qualified) click to toggle source

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

# File lib/columns_on_demand.rb, line 31
def default_select(qualified)
  @columns_to_select ||= columns_to_load_by_default.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