Hi,
I would like to access this snippet of code from within my extension
tags:
class Numeric
def ordinal
cardinal = self.to_i.abs
if (10...20).include?(cardinal) then
cardinal.to_s << 'th'
else
cardinal.to_s << %w{th st nd rd th th th th th th}[cardinal % 10]
end
end
end
As the tags get called on the page I have tried adding the above to:
module StartDate::PageExtensions
class Numeric < Page
def ordinal
cardinal = self.to_i.abs
if (10...20).include?(cardinal) then
cardinal.to_s << 'th'
else
cardinal.to_s << %w{th st nd rd th th th th th th}[cardinal %
10]
end
end
end
end
which is called from:
Page.send :include, StartDate::PageExtensions
The tag works fine when I don't call the new method, but when I do I'm
getting an "undefined method 'ordinal' error", so I must be defining
it wrong, but how do I do it right?
Any advice?
Thanks,
Dominic
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant