I need a little help cleaning up the method below. In my .NET days I
would have let this pass, but I am trying to be a good ruby citizen by
keeping things simple.
This is from a seller model which has many vehicles:
@@total_retail_price = self.vehicles.sum(:retail_price)
@@total_retail_price = 0 unless @@total_retail_price
If I didn’t have to worry about the seller having 0 vehicles I could
@@total_retail_price ||= self.vehicles.sum(:retail_price)
Does anyone have any suggestions on how I can fix improve on this?