Class: Booth::Models::Remotes::Scopes::RecentlyCreated

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/booth/models/remotes/scopes/recently_created.rb

Overview

Determines if a Remote was created recently.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.scope(base) ⇒ Object



13
14
15
16
# File 'lib/booth/models/remotes/scopes/recently_created.rb', line 13

def self.scope(base)
  base.where.not(created_at: nil)
      .where('created_at > ?', ::Booth::Models::Remote.lifespan.ago)
end

Instance Method Details

#callObject



18
19
20
21
# File 'lib/booth/models/remotes/scopes/recently_created.rb', line 18

def call
  remote.created_at.present? &&
    remote.created_at > ::Booth::Models::Remote.lifespan.ago
end