You could also just use price as a decimal or one of the currency
models (never tried one personally).  Advantage of this way you can do
calculations with this info as needed.

On Sep 13, 2:00 am, Joachim Bartosik <[email protected]> wrote:
> 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
> < 1KViewDownload

-- 
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