Module: Rails::ConsoleMethods
- Defined in:
- lib/reportly.rb
Instance Method Summary collapse
-
#report(model, *fields) ⇒ Object
(also: #r)
Creates a
:reportmethod helper exposed to rails console.
Instance Method Details
#report(model, *fields) ⇒ Object Also known as: r
Creates a :report method helper exposed to rails console
Accepts ActiveRecord::Relation and ActiveRecord::Base objects and generated a table
Example:
report User
or
report Post.all
Note :r its the alias method for :report
Usage:
report(records) # displays report with all fields
report(records, :field1, :field2, ...) # displays report with given fields
Options
-
items- The ActiveRecord objects -
fields- Filter only the given fields
25 26 27 |
# File 'lib/reportly.rb', line 25 def report(model, *fields) Reportly::ConsoleMethods.report(model, *fields) end |