Skip to content

Commit

Permalink
removing Table#== as it is not actually used
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jul 30, 2010
1 parent 19c5a95 commit bef0d30
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 16 deletions.
2 changes: 1 addition & 1 deletion lib/arel/algebra/relations/relation.rb
Expand Up @@ -129,7 +129,7 @@ def #{op}(*args)
end

def where clause = nil
clause ? Where.new(self, [clause]) : self
clause ? Where.new(self, Array(clause)) : self

This comment has been minimized.

Copy link
@brianmario

brianmario Aug 25, 2010

Apparently, Array() will break apart a string on newlines - which breaks queries with newlines in them since later in the stack this array is joined unconditonally with ' AND ' - I opened a ticket and assigned it to ya
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5457-arelar-prepending-and-unconditionally-after-newlines-in-string-literals-in-rc2

This comment has been minimized.

Copy link
@raggi

raggi Aug 25, 2010

It's actually via Enumerable#to_a, which hits String#each (so this is a 1.8 API bug in reality)

One could define String#to_ary as [self] to avoid the issue too, which I think is POLS, and makes Kernel#Array behave the same on 1.8 and 1.9

This comment has been minimized.

Copy link
@fxn

fxn Aug 25, 2010

Member

Yeah, Array() has a few gotchas, that's why Active Support provides Array.wrap http://edgeguides.rubyonrails.org/active_support_core_extensions.html#wrapping

end

def skip thing = nil
Expand Down
7 changes: 0 additions & 7 deletions lib/arel/engines/sql/relations/table.rb
Expand Up @@ -82,13 +82,6 @@ def reset
@columns = nil
@attributes = Header.new([])
end

def ==(other)
super ||
Table === other &&
name == other.name &&
table_alias == other.table_alias
end
end
end

Expand Down
8 changes: 0 additions & 8 deletions spec/sql/christener_spec.rb
Expand Up @@ -3,14 +3,6 @@
module Arel
module Sql
describe "Christener" do
it "returns the same name with two table objects" do
christener = Christener.new
table = Table.new 'users'
table2 = Table.new 'users'
christener.name_for(table).should == 'users'
christener.name_for(table2).should == 'users'
end

it "returns the first name" do
christener = Christener.new
table = Table.new 'users'
Expand Down

0 comments on commit bef0d30

Please sign in to comment.