Rails extending ActiveRecord::Base

There are several approaches : Using ActiveSupport::Concern (Preferred) Read the ActiveSupport::Concern documentation for more details. Create a file called active_record_extension.rb in the lib directory. require ‘active_support/concern’ module ActiveRecordExtension extend ActiveSupport::Concern # add your instance methods here def foo “foo” end # add your static(class) methods here class_methods do #E.g: Order.top_ten def top_ten limit(10) end end … Read more