Skip to content

Commit b2e5db9

Browse files
committed
add filtering scope
1 parent f8ac600 commit b2e5db9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

app/models/resource_item.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class ResourceItem < ActiveRecord::Base
1515
scope :sorted, ->{ order name: :asc}
1616
scope :humans, ->{ where type: 'Human' }
1717
scope :assets, ->{ where type: 'Asset' }
18+
scope :filter_by_date, -> { where("start_date < ? AND ? < end_date", Date.today, Date.today) }
1819

1920
scope :like, ->(q){
2021
if q.present?

0 commit comments

Comments
 (0)