Commit 0edc6c1 1 parent e033910 commit 0edc6c1 Copy full SHA for 0edc6c1
File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
module Kebapage
2
2
class Medium < ActiveRecord ::Base
3
3
has_attached_file :attachment ,
4
- :styles => { large : '640x480#' , thumb : '320x240#' } ,
5
- :url => '/system/ kebapage/foto_:id.:extension' ,
6
- :path => ':rails_root/public:url'
4
+ :styles => Rails . configuration . kebapage . attachment_styles ,
5
+ :url => Rails . configuration . kebapage . attachment_url ,
6
+ :path => Rails . configuration . kebapage . attachment_path
7
7
8
- validates_attachment_size :attachment , :less_than => 0 .. 512 . kilobytes
9
- validates_attachment_content_type :attachment , :content_type => %w( image/jpeg image/jpg image/png application/pdf )
8
+ validates_attachment_size :attachment , :less_than => Rails . configuration . kebapage . attachment_max_size
9
+ validates_attachment_content_type :attachment , :content_type => Rails . configuration . kebapage . attachment_content_type
10
10
11
11
Paperclip . interpolates :uniq_file_name do |attachment , style |
12
12
attachment . instance . uniq_file_name
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ class Engine < ::Rails::Engine
7
7
config . after_initialize do
8
8
config . kebapage . front_layout = 'application'
9
9
config . kebapage . admin_layout = 'hq/application'
10
+ config . kebapage . attachment_styles = { :large => '640x480#' , :thumb => '320x240#' }
11
+ config . kebapage . attachment_url = '/system/kebapage/foto_:id.:extension'
12
+ config . kebapage . attachment_path = ':rails_root/public:url'
13
+ config . kebapage . attachment_max_size = 0 ..512 . kilobytes
14
+ config . kebapage . attachment_content_type = %w( image/jpeg image/jpg image/png application/pdf )
10
15
end
11
16
end
12
17
end
You can’t perform that action at this time.
0 commit comments