用户只能编辑自己的帖子,因此我使用以下内容判断用户是否可以输入编辑表单:
def edit
@post = Load.find(:first, :conditions => { :user_id => session[:user_id], :id => params[:id]})
rescue ActiveRecord::RecordNotFound
flash[:notice] = "Wrong post it"
redirect_to :action => 'index'
end
但它不起作用,你知道我做错了什么吗?