Ruby on rails 回形针不保存图像Rails 4
我试图用回形针将图像保存到数据库,但附加的图像并没有保存到数据库。我正在使用windows 模范班Ruby on rails 回形针不保存图像Rails 4,ruby-on-rails,ruby-on-rails-4,paperclip,Ruby On Rails,Ruby On Rails 4,Paperclip,我试图用回形针将图像保存到数据库,但附加的图像并没有保存到数据库。我正在使用windows 模范班 has_attached_file :image, :path => ":rails_root/public/system/:attachment/:id/:style/:filename", :url => "/system/:attachment/:id/:style/:filename", :default_url => "/images/:style/m
has_attached_file :image,
:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
:url => "/system/:attachment/:id/:style/:filename",
:default_url => "/images/:style/missing.png"
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
在控制器中:添加图像以允许参数
html.erb
<%= form_for @product, html: { multipart: true } do |f| %>
<p>
<%= f.label :image %><br />
<%= f.file_field :image %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
迁移已经完成,字段在数据库中,但未保存任何内容。
我使用了回形针5.0.0和Rails 4.2.6解决了我的问题,没有使用回形针和CarrierWave。可能重复的