嗨,我想将图像文件调整为相同大小。
使用宝石
gem 'fog-aws'
gem "mini_magick"
gem 'carrierwave'
及以下创建模型代码
def design_create
@design = Design.new(design_params)
respond_to do |format|
if @design.save
params[:design_attachments]['portfolio'].each do |a|
@design_attachment = @design.design_attachments.create!(:portfolio => a, :design_id => @design.id)
end
format.html { redirect_to action: "design_show", id: @design.id, notice: 'Design was successfully created.' }
end
end
end
并在代码下方添加uploader.rb
version :medium_avatar do
# returns a 50x50 image
process :resize_to_fill => [50, 50]
end
我对上面的代码进行了编码,
respond_to do |format|
中的ActionController :: UnknowFormat
错误。
添加显示的控制台
回滚交易
在9ms内完成406不可接受(ActiveRecord:0.2ms)
但是如果我在添加之前删除了uploader.rb中的代码。
应用程序运行良好。
如何解决?