undefined method "load_paths" for ActiveSupport::Dependencies:Module Error

I'm writing a Rails plugin from scratch and recently generating models
inside it.
In fact, i'm trying to follow the guide from http://guides.rubyonrails.org/plugins.html
so i used the following code taken from this site in order to make the
models appear like files in the main app directory (as it was said)

this is the code:
%w{ models }.each do |dir|
  path = File.join(File.dirname(__FILE__), 'app', dir)
  $LOAD_PATH << path
  ActiveSupport::Dependencies.load_paths << path
  ActiveSupport::Dependencies.load_once_paths.delete(path)
end