diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-28 17:08:28 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-28 17:08:28 -0700 |
commit | d68165501fc80bbce34c43eaaf48381bcca27c15 (patch) | |
tree | 14cc022b9188916915f4afcb0d6977ef193b615a | |
parent | f0bf1cf7627562c87b6717b6443a56e3060dfda3 (diff) | |
download | rails-d68165501fc80bbce34c43eaaf48381bcca27c15.tar.gz rails-d68165501fc80bbce34c43eaaf48381bcca27c15.tar.bz2 rails-d68165501fc80bbce34c43eaaf48381bcca27c15.zip |
adding an easy way for sql literal nodes
-rw-r--r-- | lib/arel.rb | 6 | ||||
-rw-r--r-- | spec/nodes/sql_literal_spec.rb | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/arel.rb b/lib/arel.rb index f3dbb47ea3..eb3123fd55 100644 --- a/lib/arel.rb +++ b/lib/arel.rb @@ -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 diff --git a/spec/nodes/sql_literal_spec.rb b/spec/nodes/sql_literal_spec.rb index 390eb708e1..f5c53d9f29 100644 --- a/spec/nodes/sql_literal_spec.rb +++ b/spec/nodes/sql_literal_spec.rb @@ -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 |