Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed broken "update_timestamps" method and tests

  • Loading branch information...
commit c9a8e1adb65b892f5fa2010594b81f19ee49efcf 1 parent 1e41e1f
Igor Rzegocki authored
View
4 lib/vbulletin_rails/models/session.rb
@@ -27,7 +27,9 @@ def update_timestamps
nowstamp = Time.now.to_i
last_visit = (((nowstamp - last_activity) > VB_SESSION_TIMEOUT) ? last_activity : user.lastvisit)
update_attributes(:lastactivity => nowstamp)
- user.update_attributes(:lastactivity => nowstamp, :lastvisit => last_visit)
+ user.lastactivity = nowstamp
+ user.lastvisit = last_visit
+ user.save
return [nowstamp, last_visit]
end
return [0, 0]
View
3  test/v_bulletin_rails_model_test.rb
@@ -118,7 +118,8 @@ def teardown
assert_equal [vb_session.user.reload.lastactivity, vb_session_user_before_update.lastvisit], vb_session_after_update
assert_equal vb_session.lastactivity, vb_session.user.lastactivity
assert_equal vb_session_user_before_update.lastvisit, vb_session.user.lastvisit
- vb_session.user.update_attributes(:lastactivity => Time.now - VBulletinRails::Session::VB_SESSION_TIMEOUT - 10)
+ vb_session.user.lastactivity = Time.now - VBulletinRails::Session::VB_SESSION_TIMEOUT - 10
+ vb_session.user.save
vb_session_user_before_update = vb_session.user.reload.dup
assert_equal [vb_session.lastactivity, vb_session_user_before_update.lastactivity], vb_session.update_timestamps
assert_equal vb_session.lastactivity, vb_session.user.lastactivity
Please sign in to comment.
Something went wrong with that request. Please try again.