5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/s3_assets/relations.rb', line 5
def self.proper_asset_id(asset_id, parent)
return if asset_id.blank?
return asset_id if BSON::ObjectId.legal?(asset_id)
asset_id = "http:#{asset_id}" if asset_id.starts_with?("//")
if asset_id.starts_with?("http")
return ::S3Assets::Model.create!(absolute_url: asset_id, uploader: RequestStore.store[:current_user],
ip_address: RequestStore.store[:ip_address], parent: parent).id
else
return ::S3Assets::Utility.create!(asset_id, parent: parent).id
end
end
|