Project

dm_filter

0.0
No commit activity in last 3 years
No release in over 3 years
DmFilter is a very light weight Rails plugin that makes it easy to fetch your ActiveRecord lists using date or text as a parameter.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 10.0
~> 3.0
 Project Readme

Build Status Maintainability Test Coverage Gem Version

DmFilter

DmFilter is a very light weight Rails plugin that makes it easy to fetch your ActiveRecord lists using date or text as a parameter.

Installation

Add this line to your application's Gemfile:

gem 'dm_filter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dm_filter

include this into your model

include DmFilter

example

class Invoice < ApplicationRecord
    include DmFilter
end

Usage

Values for duration

  1. all (default)
  2. today
  3. yesterday
  4. this_week
  5. this_month
  6. last_month
  7. period

Available options

  1. duration(default is all)
  2. from(if day is equal to period)
  3. to(if day is equal to period)
  4. column_date (default is created_at)

Example

# specifying column_date
Invoice.dm_get(duration: 'today', column_date: 'paid_at')

or simply

# default column_date is created_at
Invoice.dm_get(duration: 'today')

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/denmarkmeralpis/dm_filter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.