Skip to content

Commit

Permalink
re-remove default order by clause, see 1772766
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Jun 9, 2008
1 parent bec7502 commit 550f5e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions lib/acts_as_versioned.rb
Expand Up @@ -198,8 +198,7 @@ class << self
self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
:dependent => :delete_all,
:order => 'version'
:dependent => :delete_all
}.merge(options[:association_options] || {})

if block_given?
Expand Down
7 changes: 7 additions & 0 deletions test/abstract_unit.rb
Expand Up @@ -10,6 +10,13 @@
require 'rubygems'
retry
end

begin
require 'ruby-debug'
Debugger.start
rescue LoadError
end

require 'acts_as_versioned'

config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
Expand Down
10 changes: 2 additions & 8 deletions test/versioned_test.rb
Expand Up @@ -32,7 +32,7 @@ def test_rollback_with_version_number
assert_equal 24, p.version
assert_equal 'Welcome to the weblog', p.title

assert p.revert_to!(p.versions.first.version), "Couldn't revert to 23"
assert p.revert_to!(23), "Couldn't revert to 23"
assert_equal 23, p.version
assert_equal 'Welcome to the weblg', p.title
end
Expand All @@ -59,7 +59,7 @@ def test_rollback_with_version_class
assert_equal 24, p.version
assert_equal 'Welcome to the weblog', p.title

assert p.revert_to!(p.versions.first), "Couldn't revert to 23"
assert p.revert_to!(p.versions.find_by_version(23)), "Couldn't revert to 23"
assert_equal 23, p.version
assert_equal 'Welcome to the weblg', p.title
end
Expand Down Expand Up @@ -213,11 +213,6 @@ def test_track_altered_attributes_default_value
assert SpecialLockedPage.track_altered_attributes
end

def test_version_order
assert_equal 23, pages(:welcome).versions.first.version
assert_equal 24, pages(:welcome).versions.last.version
end

def test_track_altered_attributes
p = LockedPage.create! :title => "title"
assert_equal 1, p.lock_version
Expand Down Expand Up @@ -288,7 +283,6 @@ def test_association_options
association = Page.reflect_on_association(:versions)
options = association.options
assert_equal :delete_all, options[:dependent]
assert_equal 'version', options[:order]

association = Widget.reflect_on_association(:versions)
options = association.options
Expand Down

0 comments on commit 550f5e0

Please sign in to comment.