type_scopes

Automatic scopes for ActiveRecord models.

Downloads
13.6K
Stars
80
Committers
4

Bot releases are hidden (Show)

type_scopes - 0.5.0 Latest Release

Published by alexisbernard over 3 years ago

This version brings the following new features :

  • Add negative string scopes
  • Add sensitive options to string scopes
  • Add column_matches scope to handle regex
  • Existing scopes are not overridden any more
  • Queries are generated with Arel instead of raw SQL
type_scopes - 0.4.0

Published by alexisbernard over 3 years ago

This release adds automatically 3 new ActiveRecord scopes for dates and numerics columns :

Transaction.amount_not_between(100, 200)
# => where("amount NOT BETWEEN 100 AND 200")

Transaction.amount_within(100, 200)
# => where("amount > 100 AND amount < 200")

Transaction.amount_not_within(100, 200)
# => where("amount <= 100 OR amount >= 200")