I have created a file lib/ext/date.rb
which extends the Date
class with a method.
class Date
def self.next_(weekday_string)
// code here
end
end
In my application.rb
file I autoload everything in this ext
folder
config.autoload_paths << "#{Rails.root}/lib/ext"
But I keep getting the error undefined method next_ for Date:Class
Calling this method from within the console works fine
load 'lib/ext/date.rb'; Date.next_('wednesday')
=> Wed, 07 Oct 2015
And yes, the server has been restarted before trying to use this extended method.