- Software, Release, ReleaseAsset, ExternalLink, PlatformLink, Image, SoftwareImage, Download now live in the engine under WarpEngine::, on top of WarpEngine::ApplicationRecord; table names unchanged (empty prefix) - each model runs an ActiveSupport load hook (:warp_engine_<model>) as a host extension point - WarpEngine::Image reads its upload path from WarpEngine.config - host references fully qualified (services, serializers, admin, specs); admin registrations renamed with as: so /admin URLs and route helpers are byte-identical; factories pinned to the namespaced classes - Member#image now class_name: "WarpEngine::Image" Verified: full suite green, /api/software and /api/builds byte-identical to the phase-0 baselines, admin routes unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
32 lines
1.1 KiB
Ruby
32 lines
1.1 KiB
Ruby
module WarpEngine
|
|
class Software < ApplicationRecord
|
|
self.table_name = "softwares"
|
|
|
|
has_many :software_images, foreign_key: :software_id, dependent: :destroy
|
|
has_many :images, through: :software_images
|
|
has_many :releases, foreign_key: :software_id
|
|
has_many :downloads, through: :releases
|
|
has_many :external_links, foreign_key: :software_id
|
|
|
|
accepts_nested_attributes_for :software_images, allow_destroy: true
|
|
accepts_nested_attributes_for :external_links, allow_destroy: true
|
|
accepts_nested_attributes_for :releases, allow_destroy: true
|
|
|
|
validates :name, presence: true, uniqueness: true
|
|
validates :title, presence: true
|
|
validates :platform, presence: true
|
|
|
|
default_scope { where(deleted_at: nil) }
|
|
|
|
def self.ransackable_attributes(auth_object = nil)
|
|
%w[author created_at desc highlighted id license name platform site status story title updated_at]
|
|
end
|
|
|
|
def self.ransackable_associations(auth_object = nil)
|
|
%w[releases external_links software_images images]
|
|
end
|
|
|
|
ActiveSupport.run_load_hooks(:warp_engine_software, self)
|
|
end
|
|
end
|