diff options
Diffstat (limited to 'app/models/ckeditor/picture.rb')
-rw-r--r-- | app/models/ckeditor/picture.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/ckeditor/picture.rb b/app/models/ckeditor/picture.rb new file mode 100644 index 0000000..02aa9b2 --- /dev/null +++ b/app/models/ckeditor/picture.rb | |||
@@ -0,0 +1,14 @@ | |||
1 | class Ckeditor::Picture < Ckeditor::Asset | ||
2 | has_attached_file :data, | ||
3 | url: '/uploads/pictures/:id/:style_:basename.:extension', | ||
4 | path: ':rails_root/public/uploads/pictures/:id/:style_:basename.:extension', | ||
5 | styles: { content: '800>', thumb: '118x100#' } | ||
6 | |||
7 | validates_attachment_presence :data | ||
8 | validates_attachment_size :data, less_than: 2.megabytes | ||
9 | validates_attachment_content_type :data, content_type: /\Aimage/ | ||
10 | |||
11 | def url_content | ||
12 | url(:content) | ||
13 | end | ||
14 | end | ||