Compound lists scopes to preserve ordering

This commit is contained in:
charlieablett 2019-06-26 21:49:53 +12:00
parent 5aaef1334d
commit 82b87ae509

View file

@ -5,7 +5,7 @@ class Board < ApplicationRecord
belongs_to :project belongs_to :project
has_many :lists, -> { order(:list_type, :position) }, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent has_many :lists, -> { order(:list_type, :position) }, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
has_many :destroyable_lists, -> { destroyable }, class_name: "List" has_many :destroyable_lists, -> { lists.destroyable }, class_name: "List"
validates :project, presence: true, if: :project_needed? validates :project, presence: true, if: :project_needed?
validates :group, presence: true, unless: :project validates :group, presence: true, unless: :project