Class: Jinda::Doc
- Inherits:
-
Object
- Object
- Jinda::Doc
- Includes:
- Mongoid::Attributes::Dynamic, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/generators/jinda/templates/app/models/jinda/doc.rb
Class Method Summary collapse
- .search(q, page, per_page = PER_PAGE) ⇒ Object
- .search_ma_secured(q, page, per_page = PER_PAGE) ⇒ Object
Class Method Details
.search(q, page, per_page = PER_PAGE) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/generators/jinda/templates/app/models/jinda/doc.rb', line 25 def self.search(q, page, per_page=PER_PAGE) paginate :per_page=>per_page, :page => page, :conditions => ["content_type=? AND data_text LIKE ? AND (ma_secured=? OR ma_user_id=?)", "output", "%#{q}%", false, session[:user_id] ], :order=>'ma_xmain_id DESC', :select=>'DISTINCT ma_xmain_id' end |
.search_ma_secured(q, page, per_page = PER_PAGE) ⇒ Object
31 32 33 34 35 |
# File 'lib/generators/jinda/templates/app/models/jinda/doc.rb', line 31 def self.search_ma_secured(q, page, per_page=PER_PAGE) paginate :per_page=>per_page, :page => page, :conditions => ["content_type=? AND data_text LIKE ?", "output", "%#{q}%" ], :order=>'ma_xmain_id DESC', :select=>'DISTINCT ma_xmain_id' end |