Sha256: 83e611f7f849456c4dfbeb9cbad23a76e8ac2cf2ec7ba4a1368fa6aca5e45a41
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
module Arel module Sql module Attributes def self.for(column) case column.type when :string then String when :text then String when :integer then Integer when :float then Float when :decimal then Decimal when :date then Time when :datetime then Time when :timestamp then Time when :time then Time when :binary then String when :boolean then Boolean else Undefined end end def initialize(column, *args) @column = column super(*args) end def type_cast(value) @column.type_cast(value) end # Attribute type for column types that Arel doesn't know how to handle. class Undefined < Arel::Attribute include Attributes end %w(Boolean Decimal Float Integer String Time).each do |klass| class_eval <<-R class #{klass} < Arel::Attributes::#{klass} include Attributes end R end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arel-1.0.1 | lib/arel/engines/sql/attributes.rb |
arel-1.0.0 | lib/arel/engines/sql/attributes.rb |