These are chat archives for ManageIQ/manageiq/performance

2nd
May 2016
Keenan Brock
@kbrock
May 02 2016 20:02

working:

class ExtManagementSystem
  virtual_total :vms
end

ExtManagementSystem.order(:total_vms).limit(5)

disclaimer: waiting on rails PR, so in the mean time you have to type:

ExtManagementSystem.order(ExtManagementSystem.arel_attribute(:total_vms)).first
it now sorts in the database instead of in memory
Jason Frey
@Fryguy
May 02 2016 20:06
why would you need a sort for a total?
Keenan Brock
@kbrock
May 02 2016 20:07
show the ems with the most vms or hosts?
ok, maybe not necessary
Jason Frey
@Fryguy
May 02 2016 20:07
ohhh...I misunderstood
Keenan Brock
@kbrock
May 02 2016 20:07
but in the database!
Jason Frey
@Fryguy
May 02 2016 20:07
does it also create the corresponding method?
Keenan Brock
@kbrock
May 02 2016 20:07
:)
not the association
Jason Frey
@Fryguy
May 02 2016 20:08
well, if it does I don't like that the name "total_vms" doesn't appear in the declaration
it makes it impossible to grep for
Keenan Brock
@kbrock
May 02 2016 20:08
sounds good
there is the form virtual_total :total_vms, :vms
will change to make name not optional
Jason Frey
@Fryguy
May 02 2016 20:08
yeah, that might be better
Keenan Brock
@kbrock
May 02 2016 20:08
grep is SO important
Jason Frey
@Fryguy
May 02 2016 20:08
overall though cool concept to have a virtual_ method that basically does a count
it's very common
Keenan Brock
@kbrock
May 02 2016 20:09
I often grep for send.*#{ and delete all I can
thanks for the grep statement
Jason Frey
@Fryguy
May 02 2016 20:11
:+1: