c64 enum fix

This commit is contained in:
2026-07-16 23:12:07 +02:00
parent e242427763
commit f776919769
2 changed files with 13 additions and 3 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ ActiveAdmin.register Software do
filter :name
filter :title
filter :author
filter :platform, as: :select, collection: %w[tic80 ebitengine love]
filter :platform, as: :select, collection: %w[tic80 ebitengine love c64]
filter :status, as: :select, collection: %w[development demo released archived]
filter :highlighted
@@ -40,7 +40,7 @@ ActiveAdmin.register Software do
f.input :name
f.input :title
f.input :author
f.input :platform, as: :select, collection: %w[tic80 ebitengine love]
f.input :platform, as: :select, collection: %w[tic80 ebitengine love c64]
f.input :status, as: :select, collection: %w[development demo released archived]
f.input :highlighted
f.input :license
@@ -78,7 +78,7 @@ ActiveAdmin.register Software do
f.input :name
f.input :title
f.input :author
f.input :platform, as: :select, collection: %w[tic80 ebitengine love]
f.input :platform, as: :select, collection: %w[tic80 ebitengine love c64]
f.input :status, as: :select, collection: %w[development demo released archived]
f.input :highlighted
f.input :license
+10
View File
@@ -5,6 +5,16 @@ class Release < ApplicationRecord
default_scope { where(deleted_at: nil) }
validate :c64_cannot_be_web_playable
def c64_cannot_be_web_playable
return unless software&.platform == "c64"
if html_folder_path.present? || web_playable?
errors.add(:base, "C64 releases cannot be web playable (download only)")
end
end
def self.ransackable_attributes(auth_object = nil)
%w[cartridge_path created_at deleted_at docs_folder_path html_folder_path id software_id source_path updated_at version web_playable]
end