Skip to content

Commit

Permalink
remove evil default order on case_executions association
Browse files Browse the repository at this point in the history
  • Loading branch information
ander committed Jun 14, 2012
1 parent bdd8ad8 commit 9bcac7f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/models/core/case.rb
Expand Up @@ -31,8 +31,7 @@ class Case < ActiveRecord::Base
has_and_belongs_to_many_versioned :requirements

has_many :case_executions, :class_name => 'CaseExecution',
:foreign_key => 'case_id', :order => '`created_at` DESC',
:dependent => :destroy
:foreign_key => 'case_id', :dependent => :destroy

has_many :step_executions, :through => :case_executions

Expand Down Expand Up @@ -467,7 +466,7 @@ def last_result

# returns _execution_ this case last failed in
def last_failed_exec
ce = self.case_executions.first(:conditions => ["result = :res and executions.deleted = :f", {:res => Failed.db,:f => false}], :order => 'case_executions.executed_at desc', :joins => :execution)
ce = self.case_executions.first(:conditions => ["result = :res and executions.deleted = :f", {:res => Failed.db,:f => false}], :order => 'case_executions.executed_at desc', :include => :execution)
ce ? ce.execution : nil
end

Expand Down

0 comments on commit 9bcac7f

Please sign in to comment.