В загрузке документа отказано в разрешении - PullRequest
0 голосов
/ 12 января 2019

Я настраиваю новый сервер, код на котором работает отлично, поставьте на localhost сервер, показывающий это.

В доступе отказано @ dir_s_mkdir - private_data

Я тоже пробовал enter code here, но он не работает

chmod -R 777 private_data

В документе. Rb

class Document < ApplicationRecord
 has_attached_file :document,# styles: { :original => "512x512>"},
                    :styles => {
                        :medium => "512x512>",
                        :thumb => "345x215#",
                    },
                     default_url: "/images/:style/missing.png",
                    :url=>  :set_url,
                    :path =>:set_path
  VALID_IMAGE_TYPES = ["application/pdf",'image/gif', 'image/png', 'image/jpeg', 'image/jpg']

  validates_attachment :document, content_type: { content_type: VALID_IMAGE_TYPES, :message=>"File can be JPG, JPEG, PNG, PDF"}
  validates_attachment_size :document, :less_than => 8.megabytes,:message => "Your file size is larger than 7 MB, Read the instructions properly."


  private

  def set_url
    "/documents/document_viewer/:id/:style"
  end

  def set_path
    dept=Department.find(self.department_id).branch_name
    "private_data/document/#{dept}/:class/:attachment/:id_partition/:style/:filename"
  end
end

1 Ответ

0 голосов
/ 12 января 2019

используйте ниже:

chmod -R 777 PATH_TO_APP/uploads 
chmod -R 777 PATH_TO_APP/tmp 

это должно помочь ..

...