Class: Lanes::Asset
- Inherits:
-
Model
- Object
- ActiveRecord::Base
- Model
- Lanes::Asset
show all
- Defined in:
- lib/lanes/asset.rb
Instance Method Summary
collapse
#_set_attribute_data_from_collection, #set_attribute_data, #setting_attribute_is_allowed?
Instance Method Details
#serializable_hash(options = nil) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/lanes/asset.rb', line 13
def serializable_hash(options = nil)
values = super
values.delete('file')
values.merge!(file.as_json[:file].stringify_keys)
values['original'] = { 'url' => values.delete('url') }
values
end
|
#store_uploaded_file(f) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/lanes/asset.rb', line 21
def store_uploaded_file(f)
ext = File.extname(f[:filename])
if ext.blank?
ext = '.' + FastImage.type(f[:tempfile]).to_s
end
self[:file] = ::Lanes::Strings.random + ext
file.store!(f)
end
|