Module: Gricer::ActiveModel::Statistics
- Included in:
- Gricer::ActiveRecord::Agent, Gricer::ActiveRecord::Request, Gricer::ActiveRecord::Session, Mongoid::Agent, Mongoid::Request, Mongoid::Session
- Defined in:
- lib/gricer/active_model/statistics.rb
Overview
Gricer’s statistics enhancements for ActiveModel
To add statistics to an ActiveRecord just include the module:
class SomeDataModel < ::ActiveRecord::Base
include ActiveModel::Statistics
[...]
end
This module provides two major enhancements:
Extendend attribute names
You can use relation attributes by using a dot in your attribute name.
Example:
For getting the name of the attribute name of Agent associated to the Request:
Gricer::Request.human_attributes('agent.name')
Statistics functions and filters
Methods for filtering, grouping, and counting records
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
Extend the ActiveModel with the statistics class methods.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
Extend the ActiveModel with the statistics class methods.
29 30 31 |
# File 'lib/gricer/active_model/statistics.rb', line 29 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#model_type ⇒ Object
241 242 243 |
# File 'lib/gricer/active_model/statistics.rb', line 241 def model_type self.class.model_type end |