On Apr 8, 2010, at 4:37 PM, kevinpfromnm wrote:

You can handle it a couple ways.  Cleanest if the calculated value is
useful anywhere else is to make a method in your model that returns
that value, then you can just add the method as a column.  Otherwise
you can add a column, then override the view for it (and probably the
label too so you don't get the link appearance for sorting).
parameters go like columnname-view and columnname-label IIRC


One addition to this would be to add a counter_cache option to the ambassadors association (I *believe* that will still work for a has_many :through, which I suspect ambassadors is). Then the subtraction is as simple as (on the model):

def staff_needed
  req_staffing - ambassadors_count
end

and then just add staff_needed to the field list for table-plus.

--Matt Jones

--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to