app/models/unidom/common/concerns/model_extension.rb in unidom-common-1.7.2 vs app/models/unidom/common/concerns/model_extension.rb in unidom-common-1.8
- old
+ new
@@ -14,10 +14,10 @@
scope :excluded_by, ->(exclusion) { where.not id: exclusion }
scope :transited_to, ->(states) { where state: states }
scope :valid_at, ->(now: Time.now) { where "? BETWEEN #{includer.table_name}.opened_at AND #{includer.table_name}.closed_at", now }
- scope :valid_duration, ->(range) { where "(#{includer.table_name}.opened_at BETWEEN ? AND ?) OR (#{includer.table_name}.closed_at <= ? AND #{includer.table_name}.closed_at >= ?)", range.min, range.max, range.max, range.min }
+ scope :valid_duration, ->(range) { where "(#{includer.table_name}.opened_at BETWEEN ? AND ?) OR (#{includer.table_name}.closed_at <= ? AND #{includer.table_name}.closed_at >= ?)", range.min, range.max, range.max, range.min }
scope :alive, ->(living: true) { where defunct: !living }
scope :dead, ->(defunct: true) { where defunct: defunct }
=begin