Thanks for the help! I did it through the Events model: def variance ambassadors.count - req_staffing end
And it worked! I am new to both Ruby and Hobo, but I definitely recognize the power. I'm sure I will be back here with some other seemingly simple questions! Thanks again! -Chris On Apr 8, 4:46 pm, Matt Jones <[email protected]> wrote: > 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 > athttp://groups.google.com/group/hobousers?hl=en. -- 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.
