Using Utility Classes

Hi All, I am trying to create and use our own utility classes that can have class methods and be used in many controllers. There is an inconsistent behaviour. I am not sure if I am missing anything. Here are the code snippets. In controller

def test    render :text => Utility.datetest end

utility classes are part of the model folder structure where I added couple of ruby files and created classes in them.

class ScheduleUtility

  def ScheduleUtility.datetest     "Time now is #{Time.now}"   end def ScheduleUtility.test     "Time now is #{Time.now}"   end end

class Utility def Utility.datetest   "yesterdays date:#{Time.now-1.day}" end def Utility.test   "yesterdays date:#{Time.now-1.day}" end end

When I use the Utility class's method it works perfectly fine but with the ScheduleUtility it gives a no method error undefined method `datetest' for ScheduleUtility:Class

And a further anomaly is that if I define a method by the name "test" it doesn't work in either of the cases .

these are the respective error messages private method `test' called for ScheduleUtility:Class private method `test' called for Utility:Class

would be glad if there were any valid reasons for such behaviour thanks

That's pretty interesting. So any class that we create in the model folder should follow the naming convention in synch with the file that it is in, even though it is not an active record. Thanks for the info, I will try it once I get back to work. Have a great holiday... Uma