Class: Report
- Inherits:
-
Object
- Object
- Report
- Includes:
- Ish::PremiumItem, Ish::Utils, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/report.rb
Constant Summary collapse
- PER_PAGE =
10
Class Method Summary collapse
Instance Method Summary collapse
- #export_fields ⇒ Object
-
#item_type ⇒ Object
Can be one of: default (nil), longscroll, wordpress e.g.
Methods included from Ish::Utils
Methods included from Ish::PremiumItem
Class Method Details
.clear ⇒ Object
71 72 73 74 75 |
# File 'lib/report.rb', line 71 def self.clear if Rails.env.test? self.unscoped.each { |r| r.remove } end end |
.list(conditions = { :is_trash => false }) ⇒ Object
61 62 63 64 |
# File 'lib/report.rb', line 61 def self.list conditions = { :is_trash => false } out = self.where( conditions ).order_by( :name => :asc ).limit( 100 ) [['', nil]] + out.map { |item| [ item.name, item.id ] } end |
.paginates_per ⇒ Object
67 68 69 |
# File 'lib/report.rb', line 67 def self.paginates_per self::PER_PAGE end |
Instance Method Details
#export_fields ⇒ Object
77 78 79 |
# File 'lib/report.rb', line 77 def export_fields %w| name descr | end |
#item_type ⇒ Object
Can be one of: default (nil), longscroll,
wordpress e.g. https://piousbox.com/wp-json/wp/v2/posts?slug=intro
ITEM_TYPES = %w| longscroll wordpress |
20 |
# File 'lib/report.rb', line 20 field :item_type, type: String |