class AppCatalog::WebApp < ApplicationRecord store :metadata, coder: JSON has_many :remote_storage_authorizations 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? } def update_metadata AppCatalogManager::UpdateMetadata.call(self) end end