Class: Brightcontent::Attachment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/brightcontent/attachment.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.reposition!(positions) ⇒ Object



19
20
21
22
23
24
25
26
# File 'app/models/brightcontent/attachment.rb', line 19

def self.reposition!(positions)
  positions.map! &:to_i
  transaction do
    all.each do |attachment|
      attachment.update_column :position, positions.index(attachment.id)
    end
  end
end

Instance Method Details

#attachment_stylesObject



28
29
30
# File 'app/models/brightcontent/attachment.rb', line 28

def attachment_styles
  default_attachment_styles.merge(user_defined_styles)
end

#image?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/brightcontent/attachment.rb', line 32

def image?
  asset_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}
end