class Jinda::Xmain
Public Class Methods
get(xid)
click to toggle source
number of xmains on the specified date
# File lib/generators/jinda/templates/app/models/jinda/xmain.rb, line 23 def self.get(xid) find_by(xid:xid) end
number(d)
click to toggle source
# File lib/generators/jinda/templates/app/models/jinda/xmain.rb, line 29 def self.number(d) all(:conditions=>['DATE(created_at) =?', d.to_date]).count end
search(q, page, per_page=10)
click to toggle source
# File lib/generators/jinda/templates/app/models/jinda/xmain.rb, line 32 def self.search(q, page, per_page=10) paginate :per_page=>per_page, :page => page, :conditions => ["LOWER(xvars) LIKE ?", "%#{q}%" ], :order=>'created_at DESC' end
Public Instance Methods
assign_xid()
click to toggle source
# File lib/generators/jinda/templates/app/models/jinda/xmain.rb, line 26 def assign_xid self.xid = Param.gen(:xid) end