How can I get vestal_versions to store the user who changed the record?
I'm using vestal_versions
1.0.2 and rails
2.3.8
I'm trying to associate a user with changes made to models as shown in the the documentation:
@user.update_attributes(:last_name开发者_开发问答 => "Jobs", :updated_by => "Tyler")
@user.versions.last.user # => "Tyler"
Documentation: http://github.com/laserlemon/vestal_versions
After calling @user.save
the user "Tyler" is NOT saved in versions
table used by vestal_versions.
Has anybody seen this? Is this a bug?
There seems to be a bug with mass assignment and the updated_by
parameter.
My workaround looks like this:
@my_model.updated_by = current_user
@my_model.save
I added the assignment before every save
or update_attributes
call in the controllers.
精彩评论