I'm using the Vestal Version Fork here for Rails 3 support: http://github.com/adamcooper/vestal_versions/
The issue I'm having is that the updated_by => current_user is not storing in the versions table on update.
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, :sta开发者_StackOverflow社区tus => :unprocessable_entity }
end
end
end
I checked the logs, there is no error, Rails is INSERTING NULLs in the DB for the user fields, the one I need to populate is user_id
Ideas?
Thanks
Add the following to your model class should make it work
attr_accessible :updated_by
精彩评论