2023-10-24 17:29:23 +02:00

21 lines
552 B
Ruby

class AppCatalog::WebApp < ApplicationRecord
store :metadata, coder: JSON
has_one_attached :icon do |attachable|
attachable.variant :medium, resize_to_limit: [128,128]
attachable.variant :large, resize_to_limit: [256,256]
end
has_one_attached :apple_touch_icon
validates :url, presence: true, uniqueness: true
validates :url, format: { with: URI.regexp },
if: Proc.new { |a| a.url.present? }
# before_create :update_metadata
def update_metadata
AppCatalogManager::UpdateMetadata.call(self)
end
end