Module: Mokio::Concerns::Models::Photo

Extended by:
ActiveSupport::Concern
Included in:
Photo
Defined in:
lib/mokio/concerns/models/photo.rb

Overview

Concern for Photo model

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#add_seqObject

Update seq field before_create



20
21
22
23
24
25
26
27
28
# File 'lib/mokio/concerns/models/photo.rb', line 20

def add_seq
  photo = Mokio::Photo.where(content_id: self.content_id)
  if !photo.blank?
    lastseq = photo.order_default.last.seq
    self.seq = lastseq.to_i + 1
  else
    self.seq = 1
  end 
end

#thumb_nameObject



30
31
32
# File 'lib/mokio/concerns/models/photo.rb', line 30

def thumb_name
  :thumb
end