Permalink
Browse files

adding an easy way for sql literal nodes

  • Loading branch information...
1 parent f0bf1cf commit d68165501fc80bbce34c43eaaf48381bcca27c15 @tenderlove tenderlove committed Sep 29, 2010
Showing with 11 additions and 2 deletions.
  1. +4 −2 lib/arel.rb
  2. +7 −0 spec/nodes/sql_literal_spec.rb
View
@@ -30,6 +30,8 @@ module Arel
VERSION = '2.0.0.dev'
end
-def sql raw_sql
- Arel::Nodes::SqlLiteral.new raw_sql
+module Arel
+ def self.sql raw_sql
+ Arel::Nodes::SqlLiteral.new raw_sql
+ end
end
@@ -1,6 +1,13 @@
module Arel
module Nodes
describe 'sql literal' do
+ describe 'sql' do
+ it 'makes a sql literal node' do
+ sql = Arel.sql 'foo'
+ sql.should be_kind_of Arel::Nodes::SqlLiteral
+ end
+ end
+
describe 'count' do
it 'makes a count node' do
node = SqlLiteral.new('*').count

0 comments on commit d681655

Please sign in to comment.