开发者

How can I get vestal_versions to store the user who changed the record?

开发者 https://www.devze.com 2023-01-06 14:09 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消