Module: HasImages::InstanceMethods

Defined in:
lib/has_images.rb

Instance Method Summary collapse

Instance Method Details

#create_image_by_url(url, image_type = nil) ⇒ Object



59
60
61
# File 'lib/has_images.rb', line 59

def create_image_by_url(url, image_type = nil)
  images.create!(:file_url => url, :image_type => image_type)
end


54
55
56
# File 'lib/has_images.rb', line 54

def find_or_create_gallery(name)
  galleries.find_or_create_by_name(name)
end

#galleries?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/has_images.rb', line 50

def galleries?
  galleries.any?
end

#has_more_images?Boolean

does this model have any images, that are not set as avatar?

Returns:

  • (Boolean)


46
47
48
# File 'lib/has_images.rb', line 46

def has_more_images?
  images.not_avatar.any?
end

returns all images without gallery



41
42
43
# File 'lib/has_images.rb', line 41

def images_without_gallery
  images.without_gallery
end

#more_imagesObject

returns all images that are not set as avatar



36
37
38
# File 'lib/has_images.rb', line 36

def more_images
   images.not_avatar
end