2006/5/24, Ben <whywontitletme@yahoo.com>:> I''m trying to use the ordinalize() method to ordinalize a day.
Here''s
> how far I''ve gotten:
>
> @reportday = Time.now.at_beginning_of_week.strftime("%d").to_i
> @ordinalized_reportday = "#{@reportday}".ordinalize
>
> I was thinking it wasn''t working because the date is being
returned as a
> string, however I added the .to_i and still it returns an error.
Yes, to_i gives you Fixnum, as script/console shows:
>> @reportday =
Time.now.at_beginning_of_week.strftime("%d").to_i
=> 22>> @reportday.class
=> Fixnum
However, you spoil everything with the next line?"#{@reportday}" gives
you a string:
>> "#{@reportday}".class
=> String
You can either do this way: @ordinalized_reportday = @reportday}.ordinalize,
or all at once:
@ordinalized_reportday
Time.now.at_beginning_of_week.strftime("%d").to_i.ordinalize
HTH
Regards,
Rimantas
--
http://rimantas.com/