rename lambda references to use shorthand syntax

This commit is contained in:
Albert Yi
2018-05-10 11:18:02 -07:00
parent 320f1a426e
commit 72f319ccf3
27 changed files with 69 additions and 69 deletions

View File

@@ -8,7 +8,7 @@ class BulkUpdateRequest < ApplicationRecord
validates_presence_of :user
validates_presence_of :script
validates_presence_of :title, :if => lambda {|rec| rec.forum_topic_id.blank?}
validates_presence_of :title, if: ->(rec) {rec.forum_topic_id.blank?}
validates_inclusion_of :status, :in => %w(pending approved rejected)
validate :script_formatted_correctly
validate :forum_topic_id_not_invalid
@@ -17,10 +17,10 @@ class BulkUpdateRequest < ApplicationRecord
before_validation :normalize_text
after_create :create_forum_topic
scope :pending_first, lambda { order(Arel.sql("(case status when 'pending' then 0 when 'approved' then 1 else 2 end)")) }
scope :pending, ->{where(status: "pending")}
scope :expired, ->{where("created_at < ?", TagRelationship::EXPIRY.days.ago)}
scope :old, ->{where("created_at between ? and ?", TagRelationship::EXPIRY.days.ago, TagRelationship::EXPIRY_WARNING.days.ago)}
scope :pending_first, -> { order(Arel.sql("(case status when 'pending' then 0 when 'approved' then 1 else 2 end)")) }
scope :pending, -> {where(status: "pending")}
scope :expired, -> {where("created_at < ?", TagRelationship::EXPIRY.days.ago)}
scope :old, -> {where("created_at between ? and ?", TagRelationship::EXPIRY.days.ago, TagRelationship::EXPIRY_WARNING.days.ago)}
module SearchMethods
def default_order