# Hooking in a Stats module in Rails Active Record

DevFeed: [Hooking in a Stats module in Rails Active Record](<https://devfeed.tech/articles/hooking-in-a-stats-module-in-rails-active-record-39610.md>)

Original publisher: [Read original article](<https://www.gauravsarma.com/posts/2019-06-09_Hooking-in-a-Stats-module-in-Rails-Active-Record-942c4fdbc0a9>)

Published: 2019-06-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [Gaurav Sarma's Blog](<https://devfeed.tech/sources/gaurav-sarma-s-blog.md>)

Topics: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [activerecord](<https://devfeed.tech/tags/activerecord.md>), [crud](<https://devfeed.tech/tags/crud.md>), [orm](<https://devfeed.tech/tags/orm.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>)

## AI overview

This tutorial explains how to integrate a separate statistics module into Rails Active Record by overriding model CRUD methods and tracking operation counts. It also describes why this approach does not fully handle chained ActiveRecord::Relation queries.

## Source excerpt

Most full-fledged web frameworks come with ORMs built in. ORMs or Object Relational Mappings help to map the programming language data structures to actual data stores without having to worry about the underlying data source...