I want to extend core Array class with simple method:
class Array
def to_hash
result = Hash.new
self.each { |a| result[a] = '' }
result
end
end
I put array.rb into lib/core_ext and tried to require it in application.rb by
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += Dir["#{config.root}/lib/**/"]
But still get undefined method 'to_hash' for ["var1", "var2", "var3"]:Array
if tried to use it in model method. Of course I rebooted the server after code changes.