Module: Reviewed::Attachable

Defined in:
lib/reviewed/attachable.rb

Instance Method Summary collapse

Instance Method Details

#attachments(tag = nil, opts = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/reviewed/attachable.rb', line 4

def attachments tag=nil, opts={}
  if default_attachments.include?(tag.to_s)
    return attributes['attachments'].select { |x| x.tags.include?(tag.to_s) }
  else
    fetch_attachments(opts.merge!(tags: tag)).to_a
  end
end


12
13
14
# File 'lib/reviewed/attachable.rb', line 12

def gallery tags=nil, num=8, page=1
  fetch_attachments tags: tags, :gallery => true, :per_page => num, :page => page, :order => 'priority'
end