ActiveRecord::Base in environment.rb

obviously you want to mix in the module Searchable into your ActiveRecord::Base. by using extend the methods inside the Searchable- module become class methods (with "include" they would become instance methods).

My question is why do we define such a class in environment.rb What is the actual purpose of this

since i don't know your code, i can't really tell you, what you are doing (or trying to do). besides: shouldn't you know that yourself?