Class: Image
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Image
- Defined in:
- app/models/image.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) as_json(options = {})
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/image.rb', line 18 def as_json( = {}) .merge!(only: [:id, :file_name, :created_at]) json = super() json['url'] = if [:resolution] file.thumb([:resolution]).url else file.url end json end |
- (Object) resolution
14 15 16 |
# File 'app/models/image.rb', line 14 def resolution [file.width, file.height] end |
- (Object) url
10 11 12 |
# File 'app/models/image.rb', line 10 def url file.url end |