diff --git a/app/models/card.rb b/app/models/card.rb index 7e8a72da8..d2f3a4599 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -17,7 +17,6 @@ class Card < ApplicationRecord scope :reverse_chronologically, -> { order created_at: :desc, id: :desc } scope :chronologically, -> { order created_at: :asc, id: :asc } scope :latest, -> { order updated_at: :desc, id: :desc } - scope :in_collection, ->(collection) { where collection: collection } scope :indexed_by, ->(index) do case index diff --git a/app/models/filter.rb b/app/models/filter.rb index 1ec1a5e6c..b2957bfd5 100644 --- a/app/models/filter.rb +++ b/app/models/filter.rb @@ -24,7 +24,7 @@ class Filter < ApplicationRecord result = result.unassigned if assignment_status.unassigned? result = result.assigned_to(assignees.ids) if assignees.present? result = result.where(creator_id: creators.ids) if creators.present? - result = result.in_collection(collections.ids) if collections.present? + result = result.where(collection: collections.ids) if collections.present? result = result.in_stage(stages.ids) if stages.present? result = result.tagged_with(tags.ids) if tags.present? result = terms.reduce(result) do |result, term| diff --git a/test/models/card_test.rb b/test/models/card_test.rb index fd0f26bfa..49678bd0c 100644 --- a/test/models/card_test.rb +++ b/test/models/card_test.rb @@ -88,8 +88,8 @@ class CardTest < ActiveSupport::TestCase test "in collection" do new_collection = Collection.create! name: "New Collection", creator: users(:david) - assert_equal cards(:logo, :shipping, :layout, :text), Card.in_collection(collections(:writebook)) - assert_empty Card.in_collection(new_collection) + assert_equal cards(:logo, :shipping, :layout, :text), Card.where(collection: collections(:writebook)) + assert_empty Card.where(collection: new_collection) end test "tagged with" do