Module: Reviewed::Attachable
- Defined in:
- lib/reviewed/attachable.rb
Instance Method Summary collapse
Instance Method Details
#attachments(opts = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/reviewed/attachable.rb', line 4 def opts={} = opts.has_key?(:tags) ? [opts[:tags]].flatten : [] = [] if .present? defaults = & # attachments that already exist fetch = - defaults # attachments we need to fetch if defaults.present? .each do |tag| << attributes['attachments'].select { |x| x..include?(tag.to_s) } end end if fetch.present? << (opts.merge!(tags: fetch)).to_a end else = (opts).to_a end return .flatten.uniq.compact end |
#gallery(tags = nil, num = 8, page = 1) ⇒ Object
28 29 30 |
# File 'lib/reviewed/attachable.rb', line 28 def gallery =nil, num=8, page=1 tags: , :gallery => true, :per_page => num, :page => page, :order => 'priority' end |