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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:57:06+00:00 2026-05-22T12:57:06+00:00

I have some ideas for web apps. Sadly, I have very little knowledge of

  • 0

I have some ideas for web apps. Sadly, I have very little knowledge of web development. So, I have decided to teach myself by building a “real word” example by in the form of an asset/ticket tracker after completing the Ruby on Rails Tutorial by Michael Hartl. I chose this kind of application because it is something that I am familiar with, so I already have an idea of how it should function. Such a system will also require me to use many of the features of Rails as I add features to my own application.

However, I have a few questions about modeling:

Computers, printers, monitors, cell phones are all a type of asset, so they would all share some fields (date purchased, purchase price, warranty length, notes), but they would also have some type specific fields based upon the type of asset. Looking from a strictly OOP perspective, I’d like to “sub class” it. How should I do this in Rails?

I want to randomly generate a asset and ticket numbers; should I use that number as the item’s primary key, or is that bad practice? My thought in doing so would be to create simple, useful CRUD URLs.

It’s too bad that I can only award one check per “question”; I guess I’ll choose the best overall answer. Any insights are appreciated.

  • 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-22T12:57:07+00:00Added an answer on May 22, 2026 at 12:57 pm

    You’re basically looking for Single Table Inheritance aka STI, see reference here:
    http://api.rubyonrails.org/classes/ActiveRecord/Base.html

    In a nutshell:

    Active Record allows inheritance by
    storing the name of the class in a
    column that by default is named “type”
    (can be changed by overwriting
    Base.inheritance_column). This means
    that an inheritance looking like this:

    class Company < ActiveRecord::Base;
    end

    class Firm < Company;
    end

    class Client < Company;
    end

    In your case, every device would inherit from an Asset model.

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

Sidebar

Related Questions

I have some Ruby web apps that use OpenID for authentication and store the
I have an idea for a web application and I'm having some javascript trouble.
I have some ideas, some that I have accumulated over time, but I really
I'm hoping people have some ideas to help solve this problem. I am developing
I have been researching and have some few ideas about a distributed caching system
So, I have web apps with web.configs like so: <authorization> <deny users=?/> </authorization> ...
I have a asp.net mvc web application an it uses some favicon.ico. Now when
I have been developing web apps for a while now and for the past
I'm designing a clean style to use in some web apps. And I've come
I'm interested in creating some web apps that simulate results based on data. For

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.