Skip to content

Commit

Permalink
Prevents conflicting order by clauses, e.g. "ORDER BY version desc, v…
Browse files Browse the repository at this point in the history
…ersion"
  • Loading branch information
Jim Van Fleet committed Apr 30, 2008
1 parent 4c845dc commit 1772766
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/acts_as_versioned.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ class << self
self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
:order => 'version',
:dependent => :delete_all
}.merge(options[:association_options] || {})

Expand All @@ -217,7 +216,7 @@ class << self
has_many :versions, version_association_options do
# finds earliest version of this record
def earliest
@earliest ||= find(:first)
@earliest ||= find(:first, :order => 'version')
end

# find latest version of this record
Expand Down

0 comments on commit 1772766

Please sign in to comment.