Skip to content

Commit

Permalink
raising not implemented exceptions for distinct on where it is not su…
Browse files Browse the repository at this point in the history
…pported
  • Loading branch information
tenderlove committed Apr 21, 2011
1 parent 0b9af97 commit f72989d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/arel/visitors/to_sql.rb
Expand Up @@ -142,6 +142,10 @@ def visit_Arel_Nodes_Distinct o
'DISTINCT'
end

def visit_Arel_Nodes_DistinctOn o
raise NotImplementedError, 'DISTINCT ON not implemented for this db'
end

def visit_Arel_Nodes_With o
"WITH #{o.children.map { |x| visit x }.join(', ')}"
end
Expand Down
11 changes: 11 additions & 0 deletions test/visitors/test_to_sql.rb
Expand Up @@ -299,6 +299,17 @@ def quote value, column = nil
}
end
end

describe 'distinct on' do
it 'raises not implemented error' do
core = Arel::Nodes::SelectCore.new
core.set_quantifier = Arel::Nodes::DistinctOn.new(Arel.sql('aaron'))

assert_raises(NotImplementedError) do
@visitor.accept(core)
end
end
end
end
end
end

0 comments on commit f72989d

Please sign in to comment.