Class String
In: lib/string.rb
Parent: Object

Methods

as   to_sql  

Public Instance methods

Returns the string aliased (including ‘as’) as the aliased name

   "book".as(:category)     #=> :"'book' as category"

[Source]

    # File lib/string.rb, line 16
16:   def as(alias_name)
17:     "#{self.to_sql} as #{alias_name}".to_sym
18:   end

Returns a string with single quotes escaped.

   :book.to_sql     #=> "book"

[Source]

   # File lib/string.rb, line 7
7:   def to_sql
8:     "'#{self.gsub(/'/, "''")}'"
9:   end

[Validate]