Permalink
Browse files

Merge pull request #70 from omcnet/fix-arel-node-operators

Replaced .symbolize with .to_sym in arel nodes.
  • Loading branch information...
2 parents 2033a4a + 5978997 commit dd03b08171916a6e0559e20163fd28f9a89b0a34 @danmcclain danmcclain committed Mar 14, 2013
Showing with 17 additions and 2 deletions.
  1. +2 −2 lib/postgres_ext/arel/nodes/contained_within.rb
  2. +15 −0 spec/arel/inet_spec.rb
@@ -6,15 +6,15 @@ def operator; :<< end
end
class ContainedWithinEquals < Arel::Nodes::Binary
- def operator; '<<='.symbolize end
+ def operator; '<<='.to_sym end
end
class Contains < Arel::Nodes::Binary
def operator; :>> end
end
class ContainsEquals < Arel::Nodes::Binary
- def operator; '>>='.symbolize end
+ def operator; '>>='.to_sym end
end
end
end
View
@@ -17,6 +17,21 @@ class IpAddress < ActiveRecord::Base
Object.send(:remove_const, :IpAddress)
end
+ describe "arel node operators",:wip => true do
+ it "ContainedWithin" do
+ Arel::Nodes::ContainedWithin.new(nil,nil).operator.should == :<<
+ end
+ it "ContainedWithinEquals" do
+ Arel::Nodes::ContainedWithinEquals.new(nil,nil).operator.should == '<<='.to_sym
+ end
+ it "ContainedWithinEquals" do
+ Arel::Nodes::Contains.new(nil,nil).operator.should == :>>
+ end
+ it "ContainedWithinEquals" do
+ Arel::Nodes::ContainsEquals.new(nil,nil).operator.should == '>>='.to_sym
+ end
+ end
+
describe 'quoting IPAddr in sql statement' do
it 'properly converts IPAddr to quoted strings when passed as an argument to a where clause' do
IpAddress.where(:address => IPAddr.new('127.0.0.1')).to_sql.should include("'127.0.0.1/32'")

0 comments on commit dd03b08

Please sign in to comment.