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 4005840
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:26:34+00:00 2026-05-20T08:26:34+00:00

I thought class ApplicationController < ActionController::Base include Foo is to add a mixin —

  • 0

I thought

class ApplicationController < ActionController::Base
  include Foo

is to add a “mixin” — so that all methods in the Foo module are treated as methods of the ApplicationController.

But now I see code that is

include Bar

class ApplicationController < ActionController::Base
  include Foo

So why is it outside of ApplicationController? How is that different from the more common use of putting it inside of ApplicationController?

  • 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-20T08:26:34+00:00Added an answer on May 20, 2026 at 8:26 am

    Yes, include Foo inside a class adds Foo to that class’s ancestors and thus makes all of Foo‘s instance methods available to instances of those class.

    Outside of any class definition include Foo will add Foo to the ancestors of Object. I.e. it is the same as if you did include Foo inside the definition of the Object class. The use doing this is that all of Foo‘s instance methods are now available everywhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I always thought that internal class has access to all data in its external
I initially thought that how to pass class attribute and value to markdown syntax
I thought that the purpose of Ruby's BigDecimal class is that it is infinitely
I always thought that a method parameter with a class type is passed as
Controller: class GalleriesController < ApplicationController def index @galleries = Gallery.all end end View: <%
How do I access a static member in a class with all static methods?
I understand that application_controller.rb is the place to put all the methods, etc that
route.rb: map.resource :car_users car_users_controller.rb: class CarUsersController < ApplicationController def index @car_users = CarUsers.all end
I use this class to parse a .css file. https://github.com/sabberworm/PHP-CSS-Parser I thought it's easy
I want Stats.singleton.twitter_count += 1 and I thought I could do class Stats: singleton_object

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.