Use -> instead of lambda in dashboard action scopes

Since we've changed these scopes in the previous commit because of the
new rubocop version, we're also making them consistent with the other
scopes in the same file.
This commit is contained in:
Javi Martín
2024-04-02 16:32:53 +02:00
parent f4203909db
commit d0a2c0cf66

View File

@@ -33,12 +33,8 @@ class Dashboard::Action < ApplicationRecord
scope :inactive, -> { where(active: false) }
scope :resources, -> { where(action_type: 1) }
scope :proposed_actions, -> { where(action_type: 0) }
scope :by_proposal, lambda { |proposal|
where(published_proposal: false) if proposal.draft?
}
scope :by_published_proposal, lambda { |published|
where(published_proposal: published)
}
scope :by_proposal, ->(proposal) { where(published_proposal: false) if proposal.draft? }
scope :by_published_proposal, ->(published) { where(published_proposal: published) }
def self.active_for(proposal)
published_at = proposal.published_at&.to_date || Date.current