Sha256: a84bfa683ad2308e0fe07b2ca6344d41f416abb0c37538b47a3b7b6afb2bdffb
Contents?: true
Size: 725 Bytes
Versions: 6
Compression:
Stored size: 725 Bytes
Contents
module RecordFilter class Order # :nodoc: all attr_reader :column, :direction, :table def initialize(column, direction, table) @column, @direction, @table = column, direction, table end def to_sql dir = case @direction when :asc then 'ASC' when :desc then 'DESC' end table, column = @table, @column while column.is_a?(Hash) table = table.join_association(column.keys[0]).right_table column = column.values[0] end if (!table.has_column(column)) raise ColumnNotFoundException.new("The column #{column} was not found in #{table.table_name}.") end "#{table.table_alias}.#{column} #{dir}" end end end
Version data entries
6 entries across 6 versions & 2 rubygems