Module: DB
- Defined in:
- lib/pirate.rb
Class Method Summary collapse
-
.db_concat(*args) ⇒ Object
Symbols should be used for field names, everything else will be quoted as a string.
Class Method Details
.db_concat(*args) ⇒ Object
Symbols should be used for field names, everything else will be quoted as a string
196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/pirate.rb', line 196 def self.db_concat(*args) adapter = ActiveRecord::Base.configurations[RAILS_ENV]['adapter'].to_sym args.map!{ |arg| arg.class==Symbol ? arg.to_s : arg } case adapter when :mysql "CONCAT(#{args.join(',')})" when :sqlserver args.join('+') else args.join('||') end end |