Sha256: 7d1d071527c298e91e91c8a11819d796922244034f63cd994389a5b98788e65c

Contents?: true

Size: 492 Bytes

Versions: 5

Compression:

Stored size: 492 Bytes

Contents

module Reviewed
  module Attachable

    def attachments tag, opts={}
      (@attachments ||= {})[tag] ||= fetch_attachments tag, opts
    end

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

    private

    def fetch_attachments tag, opts={}
      params = opts.merge :tags => tag
      req = Request.new :resource => Attachment, :scope => self
      req.where params
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reviewed-0.4.6 lib/reviewed/attachable.rb
reviewed-0.4.5 lib/reviewed/attachable.rb
reviewed-0.4.4 lib/reviewed/attachable.rb
reviewed-0.4.3 lib/reviewed/attachable.rb
reviewed-0.4.1 lib/reviewed/attachable.rb