Reportly
Reports for Active Record results! No configurations needed
Creates a :report
helper method and exposed to rails console
Accepts ActiveRecord::Relation
and ActiveRecord::Base
objects and generates a table
Installation
Add this line to your application's Gemfile:
gem 'reportly'
And then execute:
$ bundle
Or install it yourself as:
$ gem install reportly
Usage
From Rails console
report User
or
report Post.all
using ActiveRecord finders
report Admin.where(email: 'me@localhost.com'), :id
or use the :r
alias
r Translation
or by selecting fields
r Query, :text
or by selecting fields on ActiveRecord objects
r Query.all.first(5), :text, :id
Will generate:
+------------------+--------------------------------------+
| text | id |
+------------------+--------------------------------------+
| Ansley Bechtelar | a673cec9-b1f2-4ec4-8104-a0dbfca23771 |
| Tevin Gerlach | 92f6c49f-4628-4dbd-9812-4b2094151ff6 |
| Vivien Langosh | c452e939-4858-4113-bc3a-9db77617b11e |
| Kadin Hahn | 4aed4438-434c-4761-a119-ba4a6aa3e1b6 |
| Brenda Huels | c28c9bd4-74a9-491b-9897-12380c2cb3c8 |
+------------------+--------------------------------------+
Motivation
Looking for a simple method to generate a simple report i found this and i decided to make it a gem
For RockStars only
Todo
- Create a method
Model.report
to all active record objects
Testing
run bundle
and rake
Authors
Yannis Kolovos @yannis_kolovos
Contributing
- Fork it ( https://github.com/msroot/reportly/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
License
MIT License Copyright (c) 2015 Yannis Kolovos
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.