Adding Modules to ActiveRecord

Hi,

I need to add some methods to all my models. These methods are likely
to be used in pretty much every Rails project I work on for the
foreseeable future, so am guessing that it would be best to add them
to ActiveRecord.

The methods are all in their own modules, which include additional
modules, and are all packaged inside a single Manager module.

I have had a look into ActiveRecord, but don’t know enough about
ActiveRecord yet to dive in and change or add to it.

Could someone point me in the right direction?

Example

manager.rb
  module Manager

    # Constants Defined

    module PackageSearchResult
      include Packager
      include Result
      include Searcher

      def method1
        ...
      end
    end
  end

How would I put Manager into ActiveRecord so that all my models get
method1 by default?

Thanks

Paul

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs