Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 565 Bytes

README.md

File metadata and controls

39 lines (25 loc) · 565 Bytes

A rigid, readable alternative for defining AR scopes.

Installation

gem install scoped

Usage

require 'scoped'

Then in your ActiveRecord models:

class Meme < ActiveRecord::Base
  include Scoped

  scopes do
    sad_keanu { where(name: 'Keanu Reaves') }
  end
end
Meme.sad_keanu #=> an ActiveRecord::Relation of Memes!

Requirements

Requires ActiveRecord >= 3.1.0, <= 4.1.0, tested with Ruby 1.9.3, 2.0.0, and 2.1.0.

Running Tests

bundle exec rspec

Authors