class Phoenix::Relation
Attributes
sql[RW]
Public Class Methods
new(sql)
click to toggle source
# File lib/phoenix/relation.rb, line 7 def initialize(sql) @sql = sql end
Public Instance Methods
limit(size)
click to toggle source
# File lib/phoenix/relation.rb, line 11 def limit(size) if size.to_i > 0 self.sql << " LIMIT #{size}" end self end
order(o)
click to toggle source
# File lib/phoenix/relation.rb, line 18 def order(o) self.sql << " ORDER BY #{o}" self end
take()
click to toggle source
# File lib/phoenix/relation.rb, line 23 def take Phoenix::Rjb.execute(@sql) end
to_sql()
click to toggle source
# File lib/phoenix/relation.rb, line 32 def to_sql self.sql end
where(str)
click to toggle source
# File lib/phoenix/relation.rb, line 27 def where(str) self.sql << str if str.present? self end