Skip to content

Commit

Permalink
Force the current_revision_id to be the correct one.
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Jul 19, 2009
1 parent 09700d7 commit 078caa9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
5 changes: 0 additions & 5 deletions app/models/page.rb
Expand Up @@ -42,11 +42,6 @@ def bump_timestamps
# already have these revisions we can might as well use them to detect
# staleness.
def detect_stale_revision
puts "current"
puts current_revision_id
puts "real current"
puts revisions.current.id
puts "*" * 50
if current_revision_id.to_i != revisions.current.id
raise ActiveRecord::StaleObjectError
end
Expand Down
4 changes: 1 addition & 3 deletions test/unit/page_test.rb
Expand Up @@ -37,10 +37,7 @@ class PageTest < ActiveSupport::TestCase

test "reverting to a specific revision" do
page = create_page(:title => "A Page")
assert_equal page.title, "A Page"
update_page(page, { :body => "updated" })
update_page(page, { :body => "updated, again!"})
puts page.revisions.inspect
assert_equal 2, page.revisions.count

end
Expand All @@ -58,5 +55,6 @@ def create_page(attrs = {})
def update_page(page, attrs={})
page.revision_attributes = attrs
page.save
page.current_revision_id = page.revisions.current.id
end
end

0 comments on commit 078caa9

Please sign in to comment.