Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
set revisable_type always
  • Loading branch information
Rich Cavanaugh authored and Rich Cavanaugh committed Sep 19, 2009
1 parent 468b21b commit 9dd0998
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/acts_as_revisable/acts/revision.rb
Expand Up @@ -71,7 +71,7 @@ def revision_setup #:nodoc:
self[:revisable_current_at] = now + 1.second
self[:revisable_is_current] = false
self[:revisable_branched_from_id] = current_revision[:revisable_branched_from_id]
self[:revisable_type] = current_revision[:type]
self[:revisable_type] = current_revision[:type] || current_revision.class.name
self[:revisable_number] = (self.class.maximum(:revisable_number, :conditions => {:revisable_original_id => self[:revisable_original_id]}) || 0) + 1
end

Expand Down
2 changes: 1 addition & 1 deletion spec/sti_spec.rb
Expand Up @@ -23,7 +23,7 @@

it "revisable_type column is nil for the root type" do
@post.revise!
@post.revisions(true).first.revisable_type.should be_nil
@post.revisions(true).first.revisable_type.should == 'Post'
end

it "revisable_type column is set properly" do
Expand Down

0 comments on commit 9dd0998

Please sign in to comment.