about summary refs log tree commit diff stats
path: root/app/models/ckeditor/picture.rb
blob: 02aa9b207c44842893e2d95917efb4e0d44a4682 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Ckeditor::Picture < Ckeditor::Asset
  has_attached_file :data,
                    url: '/uploads/pictures/:id/:style_:basename.:extension',
                    path: ':rails_root/public/uploads/pictures/:id/:style_:basename.:extension',
                    styles: { content: '800>', thumb: '118x100#' }

  validates_attachment_presence :data
  validates_attachment_size :data, less_than: 2.megabytes
  validates_attachment_content_type :data, content_type: /\Aimage/

  def url_content
    url(:content)
  end
end