Sha256: 9004a2a42587c33bd39a096501be779ac5d170a59ffd1367e3346f8768b5229c

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

require "reportly/version"
require "reportly/console_methods"

module Rails
  module ConsoleMethods
    # Creates a  +:report+ method helper exposed to rails console
    #
    # Accepts <tt>ActiveRecord::Relation</tt> and <tt>ActiveRecord::Base</tt> objects 
    # and generated a table
    #
    #Example:
    #   report User
    # or 
    #   report Post.all
    # Note <tt>:r</tt> its the alias method for <tt>:report</tt>
    # 
    # Usage:
    #   report(records)  # displays report with all fields
    #   report(records, :field1, :field2, ...) # displays report with given fields
    #
    # ==== Options
    # * <tt>items</tt>   - The ActiveRecord objects
    # * <tt>fields</tt>  - Filter only the given fields
    
    def report(model, *fields)
      Reportly::ConsoleMethods.report(model, *fields)
    end
    
    alias_method :r, :report
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reportly-0.0.2 lib/reportly.rb
reportly-0.0.1 lib/reportly.rb