Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Reportable allows for the easy creation of reports based on ActiveRecord
models.
Usage is pretty easy. To declare a report on a model, simply define that the model provides a report:
class User < ActiveRecord::Base
reportable :registrations, :aggregation => :count
end
The reportable
method takes a bunch more options which are described in the API docs. For example you could generate a report on
the number of updated users records per second or the number of registrations of users that have a last name that starts with 'A'
per month:
class User < ActiveRecord::Base
reportable :last_name_starting_with_a_registrations, :aggregation => :count, :grouping => :month, :conditions => ["last_name LIKE 'A%'"]
reportable :updated_per_second, :aggregation => :count, :grouping => :hour, :date_column => :updated_at
end
For every declared report a method is generated on the model that returns the date:
User.registrations_report
User.last_name_starting_with_a_registrations_report
User.updated_per_second_report
The data is returned as an Array
of Array
s of DateTime
s and Float
s, e.g.:
[
[DateTime.now, 1.0],
[DateTime.now - 1.day, 2.0],
[DateTime.now - 2.days, 3.0]
]
Reportable provides helper methods to generate a sparkline image from this data that you can use in your views, e.g.:
<%= google_report_tag(User.registrations_report) %>
For other options to generate sparklines see the API docs.
To install the Reportable gem, simply run
[sudo] gem install reportable
To install Reportable for Rails 3.x, add it to your application's Gemfile:
gem 'reportable', :require => 'saulabs/reportable'
and generate the migration that create reportable's cache table (beware that reportable currently only supports ActiveRecord):
rails generate reportable_migration
If you want to use reportable's JavaScript graph output format, you also have to generate the JavaScript files:
rails generate reportable_raphael_assets
if you want to use Raphael or if you want to use jQuery and flot:
rails generate reportable_jquery_flot_assets
© 2008-2012 Marco Otte-Witte (http://simplabs.com) and Martin Kavalar (http://www.sauspiel.de)
Released under the MIT license
FAQs
Unknown package
We found that reportable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.