1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/arel/attributes.rb
2010-08-12 14:55:31 -07:00

20 lines
683 B
Ruby

require 'arel/attributes/attribute'
module Arel
module Attributes
###
# Factory method to wrap a raw database +column+ to an Arel Attribute.
def self.for column
case column.type
when :string, :text, :binary then String
when :integer then Integer
when :float then Float
when :decimal then Decimal
when :date, :datetime, :timestamp, :time then Time
when :boolean then Boolean
else
raise NotImplementedError, "Column type `#{column.type}` is not currently handled"
end
end
end
end