File getting uploaded and stored in public folder

This commit is contained in:
Gopesh Tulsyan 2014-05-16 12:10:32 +05:30
parent 7c7cbc0310
commit cdaa9ba41a

View file

@ -3,8 +3,14 @@ class EventAttachment < ActiveRecord::Base
belongs_to :event
attr_accessible :public, :attachment, :event_id, :title
has_attached_file :attachment, :path => ":rails_root/storage/:rails_env/attachments/:id/:style/:basename.:extension"
has_attached_file :attachment
validates_attachment_content_type :attachment, :content_type => ['text/plain','image/jpg','image/jpeg',
'image/pjpeg','image/png','image/x-png','image/gif','application/pdf','application/msword','applicationvnd.ms-word',
'applicaiton/vnd.openxmlformats-officedocument.wordprocessingm1.document','application/msexcel',
'application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/mspowerpoint',
'application/vnd.ms-powerpoint','application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/vnd.oasis.opendocument.presentation','application/vnd.openxmlformats-officedocument.wordprocessingml.document']
include Rails.application.routes.url_helpers
def to_jq_upload