Class: Sibu::Image

Inherits:
ApplicationRecord show all
Extended by:
UserConcern
Defined in:
app/models/sibu/image.rb

Class Method Summary collapse

Methods included from UserConcern

for_user

Class Method Details

.emptyObject



14
15
16
17
18
19
20
21
# File 'app/models/sibu/image.rb', line 14

def self.empty
  empty_img = where("metadata ILIKE '%default_empty_image%'").first
  if empty_img.nil?
    empty_img = new(reference: 'default_empty_image', file: File.new('app/assets/images/empty.png'))
    empty_img.save
  end
  empty_img
end

.sharedObject



10
11
12
# File 'app/models/sibu/image.rb', line 10

def self.shared
  where(user_id: nil)
end