Class: Virgo::Image

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/virgo/image.rb

Instance Method Summary collapse

Instance Method Details

#as_json(opts = {}) ⇒ Object


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/virgo/image.rb', line 37

def as_json(opts={})
  {
    id: id,
    name: name,
    alt_text: alt_text,
    credit: credit,
    description: description,
    slug: slug,
    image_url: image.try(:url),
    small_thumb_image: image.try(:url, :small_thumb),
    thumb_image: image.try(:url, :thumb),
    med_thumb_image: image.try(:url, :med_thumb),
    content_image: image.try(:url, :content),
    featured_image: image.try(:url, :featured),
    wide_image: image.try(:url, :wide)
  }
end

#redactor_jsonObject


30
31
32
33
34
35
# File 'app/models/virgo/image.rb', line 30

def redactor_json
  {
    thumb: image.url(:thumb),
    image: image.url
  }
end

#url(arg) ⇒ Object


26
27
28
# File 'app/models/virgo/image.rb', line 26

def url(arg)
  image.url
end