mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-10 21:24:20 +01:00
11 lines
406 B
Ruby
11 lines
406 B
Ruby
|
class CustomAsset < ActiveRecord::Base
|
||
|
has_one :custom_asset_file, as: :viewable, dependent: :destroy
|
||
|
accepts_nested_attributes_for :custom_asset_file, allow_destroy: true
|
||
|
|
||
|
# static method to retrieve the attachement URL of the custom asset
|
||
|
def self.get_url(name)
|
||
|
asset = CustomAsset.find_by(name: name)
|
||
|
asset.custom_asset_file.attachment_url if asset and asset.custom_asset_file
|
||
|
end
|
||
|
end
|