我想用回形针验证文件的存在。当我尝试提交表单时,它会回滚,但出于某种原因,它会查找不存在的create.erb模板。我不明白使用宝石任何类型的错误信息或者回形针验证
class Image < ActiveRecord::Base
has_attached_file :photo,
:styles => {
:thumb => "100x100#",
:small => "750x750>" }
validates_attachment_presence :photo
class ImagesController < ApplicationController
before_filter :require_user, :only => [:new, :create]
def new
@image = Image.new
end
def create
@image = Image.new(params[:image])
@image.user = current_user
if @image.save
flash[:notice] = 'image uploaded'
redirect_to :controller => "images", :action => "index"
end
end
def show
@image = Image.find(params[:id])
end
的,版本2.3.3
你可以粘贴你的ImagesController吗? – 2010-07-09 16:33:05