rename lambda references to use shorthand syntax
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user