Sha256: b19569459375d7d62f4fc4ce32ea27b254b6fdc1f56ae02f22641a09ba84315d

Contents?: true

Size: 394 Bytes

Versions: 7

Compression:

Stored size: 394 Bytes

Contents

class User < ActiveRecord::Base
  
  scope :enabled, where(:enabled => true)
  scope :search, lambda { |pattern|
    where('firstname LIKE ? OR lastname LIKE ?', "%#{pattern}%", "%#{pattern}%")
  }
  scope :created_between, lambda { |after, before|
    where('created_at >= ? AND created_at <= ?', after, before)
  }
  scope :latest, lambda {
    where('created_at >= ?', 1.week.ago)
  }
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scoped_from-0.6.0 spec/mocks/user.rb
scoped_from-0.5.1 spec/mocks/user.rb
scoped_from-0.5.0 spec/mocks/user.rb
scoped_from-0.5 spec/mocks/user.rb
scoped_from-0.4 spec/mocks/user.rb
scoped_from-0.3 spec/mocks/user.rb
scoped_from-0.2 spec/mocks/user.rb