Rails4 where should I put my own extensions for existing library?
ruby, ruby-on-rails, ruby-on-rails-4
Solution
Probably `lib`.
`lib/core_ext` can contain extensions for standard functions, and vendor-named directories under `lib` for others.
`config/initializers` is another commonly used location.
I'd recommend spending time looking at other projects to find what seems most common and works best for you.
Some links that may be of interest:
- In Ruby on Rails, to extend the String class, where should the code be put in?
- How to include all lib folder?
- http://guides.rubyonrails.org/plugins.html#extending-core-classes
Problem
I have created modules to add some extra functions to the existing libraries, which include both ruby built-in library and third party library (like String, Hash, ActiveModel and Nokogiri). such as ``` # extension for ExistingClass module SomeExtension def extra_method ... end end ExistingClass.send(:include, SomeExtension::extra_method) ``` Where is the best location to put them in?