Class: Ecm::Pictures::Gallery

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

Instance Method Summary collapse

Instance Method Details

#display_code_for_erb ⇒ Object



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

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

#human ⇒ Object



56
57
58
# File 'app/models/ecm/pictures/gallery.rb', line 56

def human
  name
end

#picture_images=(picture_images) ⇒ Object



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

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_picture ⇒ Object



60
61
62
# File 'app/models/ecm/pictures/gallery.rb', line 60

def preview_picture
  pictures.published.first
end

#to_s ⇒ Object



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

def to_s
  name
end