Sha256: d8fedeb8f6036ebb251fc7f42190f1207cfb2b28b8eeec7d4bf01ce39d452a28
Contents?: true
Size: 703 Bytes
Versions: 7
Compression:
Stored size: 703 Bytes
Contents
module Brightcontent class Attachment < ActiveRecord::Base attr_accessible :attachable_id, :attachable_type, :asset belongs_to :attachable, polymorphic: true has_attached_file :asset, :styles => lambda {|attachment| attachment.instance.attachment_styles } delegate :url, to: :asset validates :asset, attachment_presence: true def attachment_styles user_defined_styles.merge(default_attachment_styles) end private def user_defined_styles if attachable && attachable.respond_to?(:attachment_styles) attachable.attachment_styles end || {} end def default_attachment_styles { brightcontent: "100x100#" } end end end
Version data entries
7 entries across 7 versions & 1 rubygems