Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7032a50297
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (32 sloc) 0.833 kb
module Arel
class Table < Relation
include Recursion::BaseCase
cattr_accessor :engine
attr_reader :name, :engine
hash_on :name
def initialize(name, engine = Table.engine)
@name, @engine = name.to_s, engine
end
def attributes
@attributes ||= columns.collect do |column|
Attribute.new(self, column.name.to_sym)
end
end
def column_for(attribute)
has_attribute?(attribute) and columns.detect { |c| c.name == attribute.name.to_s }
end
def columns
@columns ||= engine.columns(name, "#{name} Columns")
end
def reset
@attributes = @columns = nil
end
def ==(other)
Table === other and
name == other.name
end
end
end
def Table(name, engine = Arel::Table.engine)
Arel::Table.new(name, engine)
end
Jump to Line
Something went wrong with that request. Please try again.