我想用回形針驗證文件的存在。當我嘗試提交表單時,它會回滾,但出於某種原因,它會查找不存在的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