Scott Seago
2009-Jan-20 18:37 UTC
[Ovirt-devel] [PATCH] fix for 468378: details pane for disabled hosts.
A prior refactoring removed the 'do' and 'end' around an association method -- this patch restores it. Signed-off-by: Scott Seago <sseago at redhat.com> --- src/app/models/host.rb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/models/host.rb b/src/app/models/host.rb index 813bc1d..e4ae5d6 100644 --- a/src/app/models/host.rb +++ b/src/app/models/host.rb @@ -35,11 +35,12 @@ class Host < ActiveRecord::Base has_many :cpus, :dependent => :destroy has_many :nics, :dependent => :destroy has_many :bondings, :dependent => :destroy - has_many :vms, :dependent => :nullify - + has_many :vms, :dependent => :nullify do def consuming_resources find(:all, :conditions=>{:state=>Vm::RUNNING_STATES}) end + end + has_many :tasks, :as => :task_target, :dependent => :destroy, :order => "id ASC" do def queued find(:all, :conditions=>{:state=>Task::STATE_QUEUED}) -- 1.6.0.6
Jason Guiditta
2009-Jan-26 18:02 UTC
[Ovirt-devel] [PATCH] fix for 468378: details pane for disabled hosts.
On Tue, 2009-01-20 at 18:37 +0000, Scott Seago wrote:> A prior refactoring removed the 'do' and 'end' around an association method -- this patch restores it. > > Signed-off-by: Scott Seago <sseago at redhat.com> > --- > src/app/models/host.rb | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/app/models/host.rb b/src/app/models/host.rb > index 813bc1d..e4ae5d6 100644 > --- a/src/app/models/host.rb > +++ b/src/app/models/host.rb > @@ -35,11 +35,12 @@ class Host < ActiveRecord::Base > has_many :cpus, :dependent => :destroy > has_many :nics, :dependent => :destroy > has_many :bondings, :dependent => :destroy > - has_many :vms, :dependent => :nullify > - > + has_many :vms, :dependent => :nullify do > def consuming_resources > find(:all, :conditions=>{:state=>Vm::RUNNING_STATES}) > end > + end > + > has_many :tasks, :as => :task_target, :dependent => :destroy, :order => "id ASC" do > def queued > find(:all, :conditions=>{:state=>Task::STATE_QUEUED})ACK, I can now disable/enable a host and view its detail pane in either state w/o error.