Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6200047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:17:52+00:00 2026-05-24T04:17:52+00:00

I’m working on an ApplicationModel for a Rails app that has over 200 modules.

  • 0

I’m working on an ApplicationModel for a Rails app that has over 200 modules. The app is so large that when we rails s it literally takes 40 seconds to load our app. So in development we have a ton modules we often change and to see the changes we have to reload the app.

So I created an ApplicationModel and moved all the initializers into that model so changes are reloaded in development and we do not have to restart the server again saving lots of time everyday.

I made ApplicationModel inherit from ActiveRecord::Base and made it an abstract class. All other models inherit from this model. So now we can put our initializers that extend ActiveRecord into this model.

Since I’m working on a project that other people started I don’t know the difference between these two ways of extending ActiveRecord and would like to know the differences between them.

ActiveRecord::Base.send(:include, someModule)
ActiveRecord::Base.extend(ClassMethods)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:17:52+00:00Added an answer on May 24, 2026 at 4:17 am

    First, I think you’re overcomplicating this a bit. If you want to reload your application’s models in the console, the best choice is to just run reload!, not a complicated custom solution.

    Second, the difference between these two choices:

    ActiveRecord::Base.send   :include, M
    ActiveRecord::Base.extend M
    

    is that include adds the module to the class, just as if you’d copy-pasted the instance methods in the module right into the class’s definition.

    By contrast, extend will add the module to the metaclass, just as if you’d copy-pasted the instance methods in the module into a class << self block in the class.

    Here’s an illustrative example:

    module InstanceMethods
      def foo; "foo"; end
    end
    
    class ActiveRecord::Base
      include InstanceMethods
    end
    
    ActiveRecord::Base.instance_methods.include? :foo
    => true
    

    But:

    module ClassMethods
      def bar; "bar"; end
    end
    
    class ActiveRecord::Base
      extend ClassMethods
    end
    
    ActiveRecord::Base.instance_methods.include? :bar
    => false   # hmm, it's not an instance method...
    
    ActiveRecord::Base.singleton_class.instance_methods.include? :bar
    => true    # ... it's a class method, aka an
               # instance method on the metaclass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
We're building an app, our first using Rails 3, and we're having to build
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.