提交 113240e0 编写于 作者: A Aaron Patterson

adding attribute#lower for lowercasing an attribute

上级 30c7f0e4
......@@ -4,6 +4,12 @@ class Attribute < Struct.new :relation, :name
include Arel::Expressions
include Arel::Predications
include Arel::Math
###
# Create a node for lowering this attribute
def lower
relation.lower self
end
end
class String < Attribute; end
......
......@@ -2,6 +2,14 @@
module Arel
describe 'Attributes' do
it 'responds to lower' do
relation = Table.new(:users)
attribute = relation[:foo]
node = attribute.lower
assert_equal 'LOWER', node.name
assert_equal [attribute], node.expressions
end
describe 'for' do
it 'deals with unknown column types' do
column = Struct.new(:type).new :crazy
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册