Sha256: 59965f5e4a0d3ed7d374fc20570b15d4991683a8c3f3c63924db3f9c028248df
Contents?: true
Size: 637 Bytes
Versions: 13
Compression:
Stored size: 637 Bytes
Contents
module Locomotive module Extensions module Asset module Types extend ActiveSupport::Concern included do %w{media image stylesheet javascript font pdf}.each do |type| scope :"only_#{type}", where(content_type: type) define_method("#{type}?") do self.content_type.to_s == type end end end module ClassMethods def by_content_type(content_type) return self.all if content_type.blank? self.all.where(content_type: content_type.to_s) end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems