0
我在这里使用的维斯塔版本叉为Rails 3支持:http://github.com/adamcooper/vestal_versions/维斯塔版本 -
我遇到的问题是,updated_by => CURRENT_USER没有在版本表中存储的更新。
def update
@book = Book.find(params[:id])
respond_to do |format|
if @book.update_attributes(params[:book].merge(:updated_by => current_user))
format.html { redirect_to(@book, :notice => 'Book was
successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @book.errors, :status => :unprocessable_entity }
end
end
end
我查了日志,没有错误,Rails正在插入空值在DB用户领域,一个我需要填充是USER_ID
想法?
感谢
我想这不用说,你其实记录这段代码运行时? – brad 2010-09-12 18:18:48
好问题:)是的,current_user正在控制器中的其他方法中使用,以达到我可以更新书籍的位置 – AnApprentice 2010-09-12 19:48:51
这方面的进展如何?我正在经历同样的行为。 – 2010-11-26 21:16:20