使用回形针GEM时出现以下错误。我尝试上传JPG / PNG并且都无效。好像我得到了验证错误。任何帮助都会非常棒!谢谢!
的内容不是他们所报道的内容
iinstall file.exe并添加
Paperclip.options[:command_path] = 'C:\Program Files (x86)\GnuWin32\bin'
到devlopement.rb
my pic.rb
class Pic < ActiveRecord::Base belongs_to :user
has_attached_file :image, :styles => { :medium => "300x300>" }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/ end
我的show.html.haml
= image_tag @pic.image.url
%h1= @pic.title
%p= @pic.description
%p
Pic by
= @pic.user.try(:email)
%br
= link_to "Back", root_path
= link_to "Edit", edit_pic_path
= link_to "Delete", pic_path, method: :delete, data: { confirm: "Are you sure?" }
答案 0 :(得分:0)
Probléme将更新宝石回形针从4.2.0解决到5.0.0 并运行bundle install