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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:25:21+00:00 2026-06-11T05:25:21+00:00

Even though, it is a beginner rails question, I wanted to ask on here,

  • 0

Even though, it is a beginner rails question, I wanted to ask on here, stackoverflow, just to get the logic of this right

Basically I’m looking for a solution to create an abstract class (but since we are mentioning about rails, it’s more like abstract models). The reason why I could not understand it is because I always generate my models and controllers (without scaffold) and I couldn’t find any online solution such that I will generate a model that inherits from an abstract class I’ve predefined.

Basically, assume that I have a class Creature with common attributes like eyes, nose etc. and I want to create Human and Dog class inheriting from that class. How would I be able to do that. Would it be possible to add an option to terminal command rails g controller Human inherits:Create or anything like that.

Sincerely, looking for the common and the efficient solution.

  • 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-06-11T05:25:23+00:00Added an answer on June 11, 2026 at 5:25 am

    No, rails generators don’t have this functionality, but you always can do it by yourself.

    # app/models/creature.rb
    class Creature
      attr_accessor :eyes, :nose
    end
    
    # app/models/human.rb
    class Human < Creature
    end
    
    # app/models/dog.rb
    class Dog < Creature
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner Rails programmer and even though this question might be too easy,
Even though I have a fermi card(gtx 560) I get this error on VS2010:
Unfortunately I'm probably still too much a Rails beginner, so, even though I thought
this is a bit of a beginner's question, but I've searched everywhere and can't
Apologies in advance if this is a silly question, am very much a beginner.
Even though the topic title explains most of the question, I'd like to sketch
Ok, this is really really easy, but even though I went through 100s of
This is definitely a beginner's question. There are two issues. The id in my
Even though stackoverflow has helped many times before, it is the first time I
Hey, a beginner's question here.... In order to learn PHP and SQl I have

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.