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

  • SEARCH
  • Home
  • 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 952285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:52:09+00:00 2026-05-15T23:52:09+00:00

I was just looking around rails and noticed there is an app controller but

  • 0

I was just looking around rails and noticed there is an app controller but no app model.

Is there no root model in rails ? if not where do you put a piece of code that needs to be in every model.

Thanks, Alex

  • 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-15T23:52:11+00:00Added an answer on May 15, 2026 at 11:52 pm

    Nothing says your controllers have to subclass ApplicationController but it generally is the standard because the vast majority of rails applications make use of the layout capabilities (which can vary on each controller), so instead of forcing the rare ones without layouts from turning the layout off (layout nil or layout false) for each controller, they make an ‘abstract’ one that you can turn controller features on and off easily for your whole application.

    Now for models, you could create an ApplicationModel for all of your models to subclass, but there are two things to think about:

    1. ActiveRecord normally detects when you subclass an already subclassed ActiveRecord::Base and uses this to turn STI (single table inheritance) on.
    2. ApplicationModel will be an actual model that is expected to have a table in your database. This can lead to problems down the line.

    To fix these two problems, you have to set abstract_class to true for ActiveRecord to properly function.

    class ApplicationModel < ActiveRecord::Base
      self.abstract_class = true
    end
    

    In contrast to an abstract ActionController, abstract_class must set to true which means the developer must know they cannot remove this line from ApplicationModel. With ApplicationController you can do pretty much whatever you want to it.

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

Sidebar

Related Questions

Just looking for the relevant documentation. An example is not necessary, but would be
I am just looking at the source code of BlogEngine.Net and was intrigued at
Sometimes it might be useful, but mostly just looking cool or impressive to visualize
I'm looking to build a rails web app with an admin control panel. I'd
Tried looking around for a regex pattern for a full name and just can't
Afternoon, I've been looking around for a while without success to see if there's
I can usually google around and find this kind of thing but I just
I have a roles model in a rails app that I have written a
I am just beginning to play around with node.js and was looking through the
I'm playing around with the iosched app from Google I/O 2011. Looking at the

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.