Sha256: ea39480167a25c9abe00152d5b1c41c11604b4cc2932f0ba4481e2f66346ae3e
Contents?: true
Size: 710 Bytes
Versions: 4
Compression:
Stored size: 710 Bytes
Contents
module RecordFilter class Order 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_name}.#{column} #{dir}" end end end
Version data entries
4 entries across 4 versions & 2 rubygems