Module: Analytics::Selectors
- Included in:
- Analytics
- Defined in:
- lib/analytics_logger/analytics/selectors.rb
Overview
All the custom selectors for the Analytics class
Instance Method Summary collapse
-
#find_by_name(name) ⇒ Object
because AnalyticEvents don’t store their own name, we have handy helper to find them.
- #find_event_type(id) ⇒ Object
- #latest(limit = 2) ⇒ Object
- #sort_events_by_count ⇒ Object
Instance Method Details
#find_by_name(name) ⇒ Object
because AnalyticEvents don’t store their own name, we have handy helper to find them
8 9 10 |
# File 'lib/analytics_logger/analytics/selectors.rb', line 8 def find_by_name(name) AnalyticsEventType.find_by_name(name).analytics_events end |
#find_event_type(id) ⇒ Object
20 21 22 |
# File 'lib/analytics_logger/analytics/selectors.rb', line 20 def find_event_type(id) AnalyticsEventType.find(id) end |
#latest(limit = 2) ⇒ Object
12 13 14 |
# File 'lib/analytics_logger/analytics/selectors.rb', line 12 def latest(limit = 2) AnalyticsEventType.find(:all, :order => "created_at DESC", :limit => limit) end |
#sort_events_by_count ⇒ Object
16 17 18 |
# File 'lib/analytics_logger/analytics/selectors.rb', line 16 def sort_events_by_count AnalyticsEventType.sort_by_count.all end |