0

ここでは、Rails 3 のサポートのために Vestal バージョン フォークを使用しています: 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 に NULL を挿入しています。入力する必要があるのは user_id です。

アイデア?

ありがとう

4

1 に答える 1

1

モデルクラスに以下を追加すると、機能するはずです

attr_accessible  :updated_by
于 2011-08-31T11:49:43.253 に答える