Class: Ecm::Pictures::Gallery

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/ecm/pictures/gallery.rb

Instance Method Summary collapse

Instance Method Details

#display_code_for_erbObject



34
35
36
# File 'app/models/ecm/pictures/gallery.rb', line 34

def display_code_for_erb
  "<%= render_picture_gallery '#{name}' %>"
end

#humanObject



49
50
51
# File 'app/models/ecm/pictures/gallery.rb', line 49

def human
  name
end

#picture_images=(picture_images) ⇒ Object



38
39
40
41
42
43
# File 'app/models/ecm/pictures/gallery.rb', line 38

def picture_images=(picture_images)
  picture_images.each do |image|
    next if image.respond_to?(:empty?) && image.empty?
    pictures.build(image: image)
  end
end

#preview_pictureObject



53
54
55
# File 'app/models/ecm/pictures/gallery.rb', line 53

def preview_picture
  pictures.first
end

#to_sObject



45
46
47
# File 'app/models/ecm/pictures/gallery.rb', line 45

def to_s
  name
end