12.09.2010 20:38, peter booth wrote: > I'm writing an app that tracks small businesspeople who typically have > rate cards that specify a price in dollars for 30 mins, 45 mins, 60 > minutes or multiple hours. Each businessperson does there thing - some > could charge for 55 min or 11 minutes if they so chose. > > Is there a "right way" to model this rate in Hobo, that is smarter > than using Strings? > > $160 for 30 minutes > $200 for 60 minutes
I'd start with something like: class RateCard belongs_to :business_person minutes :integer price :integer #in cents def dollars; price/100; end def cents; price%100; end end class BusinessPerson has_many :rate_cards end <def tag="view" for="RateCard> $<view:dollars/>.<view:cents/> for <view:minutes/> minutes.<br/> </view> Then I'd add permissions, validations, view hints etc. to have it work properly. Regards, Joachim
signature.asc
Description: OpenPGP digital signature
