Class: Dust::Contact
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Dust::Contact
- Defined in:
- app/models/dust/contact.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.page(search, page, date) ⇒ Object
14 15 16 |
# File 'app/models/dust/contact.rb', line 14 def self.page(search, page, date) search(search, date).order("created_at DESC").paginate(:per_page => 12, :page => page) end |
.search(search, date) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/models/dust/contact.rb', line 23 def self.search(search, date) if search where("name LIKE ? OR email LIKE ? OR message LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%") elsif date where("date(created_at) IS ?", (Time.at(date.to_i / 1000)).to_date) else scoped end end |
.total_on(date) ⇒ Object
10 11 12 |
# File 'app/models/dust/contact.rb', line 10 def self.total_on(date) where("date(created_at) = ?", date) end |