Permalink
Browse files

Merge pull request #4 from stengland/master

update_attributes method should persist data
  • Loading branch information...
2 parents 92bfcbd + 1dbf334 commit a8e4863afdb200a4f0a9a9cb00df974f824e6eb4 @dhruvasagar dhruvasagar committed Oct 27, 2011
Showing with 3 additions and 1 deletion.
  1. +1 −1 lib/versionable/plugins/versionable.rb
  2. +2 −0 test/unit/test_versioning.rb
@@ -7,7 +7,7 @@ module InstanceMethods
def update_attributes(attrs={})
updater_id = attrs.delete(:updater_id)
assign(attrs)
- save_version(updater_id) if self.respond_to?(:rolling_back) && !rolling_back
+ save(:updater_id => updater_id)
end
def save(options={})
@@ -115,6 +115,8 @@ class VersioningTest < Test::Unit::TestCase
should 'create a new version for changes' do
versions_count = @user.versions_count
@user.update_attributes(:fname => 'Dave')
+ @user.reload
+ assert_equal @user.fname, 'Dave'
assert_equal @user.versions_count, (versions_count + 1)
end
should 'not create a new version without changes' do

0 comments on commit a8e4863

Please sign in to comment.