diff --git a/app/models/collection.rb b/app/models/collection.rb index 8e25e4b474..320933ea60 100644 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -4,18 +4,18 @@ # # Table name: collections # -# id :bigint(8) not null, primary key -# description :text not null -# discoverable :boolean not null -# local :boolean not null -# name :string not null -# remote_items :integer -# sensitive :boolean not null -# uri :string -# created_at :datetime not null -# updated_at :datetime not null -# account_id :bigint(8) not null -# tag_id :bigint(8) +# id :bigint(8) not null, primary key +# description :text not null +# discoverable :boolean not null +# local :boolean not null +# name :string not null +# original_number_of_items :integer +# sensitive :boolean not null +# uri :string +# created_at :datetime not null +# updated_at :datetime not null +# account_id :bigint(8) not null +# tag_id :bigint(8) # class Collection < ApplicationRecord MAX_ITEMS = 25 @@ -28,9 +28,10 @@ class Collection < ApplicationRecord validates :name, presence: true validates :description, presence: true validates :uri, presence: true, if: :remote? - validates :remote_items, presence: true, - numericality: { greater_than_or_equal: 0 }, - if: :remote? + validates :original_number_of_items, + presence: true, + numericality: { greater_than_or_equal: 0 }, + if: :remote? validate :tag_is_usable validate :items_do_not_exceed_limit diff --git a/db/migrate/20251118115657_create_collections.rb b/db/migrate/20251118115657_create_collections.rb index 311b2fdd94..299cc7aade 100644 --- a/db/migrate/20251118115657_create_collections.rb +++ b/db/migrate/20251118115657_create_collections.rb @@ -11,7 +11,7 @@ class CreateCollections < ActiveRecord::Migration[8.0] t.boolean :sensitive, null: false # rubocop:disable Rails/ThreeStateBooleanColumn t.boolean :discoverable, null: false # rubocop:disable Rails/ThreeStateBooleanColumn t.references :tag, foreign_key: true - t.integer :remote_items + t.integer :original_number_of_items t.timestamps end diff --git a/db/schema.rb b/db/schema.rb index cc00e9d64e..b836267291 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -377,7 +377,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_19_093332) do t.boolean "sensitive", null: false t.boolean "discoverable", null: false t.bigint "tag_id" - t.integer "remote_items" + t.integer "original_number_of_items" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["account_id"], name: "index_collections_on_account_id" diff --git a/spec/models/collection_spec.rb b/spec/models/collection_spec.rb index aa839973b1..c6a500210f 100644 --- a/spec/models/collection_spec.rb +++ b/spec/models/collection_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Collection do it { is_expected.to validate_presence_of(:uri) } - it { is_expected.to validate_presence_of(:remote_items) } + it { is_expected.to validate_presence_of(:original_number_of_items) } end context 'when using a hashtag as category' do