Skip to content

Instantly share code, notes, and snippets.

View RohanM's full-sized avatar

Rohan Mitchell RohanM

View GitHub Profile
@ledermann
ledermann / ransack.rb
Created November 23, 2012 11:29
Ransack with scopes
# Patch for ransack (https://github.com/ernie/ransack) to use scopes
# Helps migrating from Searchlogic or MetaSearch
# Place this file into config/initializer/ransack.rb of your Rails 3.2 project
#
# Usage:
# class Debt < ActiveRecord::Base
# scope :overdue, lambda { where(["status = 'open' AND due_date < ?", Date.today]) }
# end
#
# Ransack out of the box ignores scopes. Example: