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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:25:26+00:00 2026-05-25T00:25:26+00:00

I a implementing single table inheritance but am having some trouble with the routing.

  • 0

I a implementing single table inheritance but am having some trouble with the routing. I have two classes, Gamma and Beta, and both inherit from Alpha. I know that if I want to use Alpha as the controller as opposed to individual controllers for Beta and Gamma, I can follow the instructions here for having a resource default to another controller.

However, what I want to do is have some methods be handled by a central Alpha controller (e.g. edit and update), while other methods be handled by the subclass Beta and Gamma controllers. How can I specify which methods should be pointed to the Alpha controller and which should remain to be handled by Beta and Gamma?

  • 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-25T00:25:26+00:00Added an answer on May 25, 2026 at 12:25 am

    Use inheritance with your controllers. Implement your edit and update functions in an AlphaController class, and then inherit from that class in you BetaController and GammaController classes, where you then implement your other functions.

    class AlphaController < ActionController::Base
    
       def edit
          ...
       end
    
       def update
          ...
       end
    
    end
    
    class BetaController < AlphaController
    
       def index
          ...
       end
    
    end
    

    Note that this will make your URLs …/beta/edit and …/beta/update.

    You would only want to use the views/alpha/edit.html.erb as a partial view, and then render the alpha view page as a partial in your beta/gamma views.

    Remember that even though you are storing the objects in one table Alpha, you still have two classes in your model, Beta and Gamma, and should treat them as such.

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

Sidebar

Related Questions

Been having some trouble implementing a single-column index in LaTeX. I've been employing the
Is it possible to use generic support with single table inheritance, and still be
My situation is this: We have a superclass, MyAbstractEntity @Entity @Table(name = MyTable) @Inheritance(strategy
I'm enamoured with the idea of implementing my own single-entry-point gateway that does two
I have a domain http://abc.com and a subdomain http://sub.abc.com . I'm implementing single sign-on
I am implementing two objects, say HotDog and Burger, and they are both subclass
I'm implementing a JPA-like process: all classes representing a table must subclass a DBTable
Need suggestions on implementing associating single or many objects to an entity. All soccer
I'm implementing billboards for vegetation where a billboard is of course a single quad
When implementing Quicksort, one of the things you have to do is to choose

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.