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

The Archive Base Latest Questions

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

I need to be able to match prospective owners to abandoned animals based on

  • 0

I need to be able to match prospective owners to abandoned animals based on varying criteria and locations.

The owner will have a particular criteria set. Animal type = “dog”, breed = “Labrador Retriever”, age will need to be between 1 and 5, sex = male, and so on…

The animal will also have a particular criteria set. The animal type = “Dog”, age = 3, sex = male, breed = “Chihuahua”.

The animal could also be: type = “Cat”, age = “12”, sex = female, breed = “Tiger”.

I also have a “Location” model for both the owner and the animal (polymorphic) that contains the information related to the location of either the animal or the owner.

So that part is easy…

The hard part (at least for me) is when I need to specify different criteria for different animal types. So an animal of type = “dog” may have a criteria of “can fetch?” whereas an animal of type cat may have a criteria of “de-clawed?” and a animal of type “fish” may have criteria of “pattern” with multiple options of [“speckled”, “striped”, “plain”].

What I have now is an “animal” model with the generic animal information (age, sex, breed), then I have a breeds model with the various breeds per animal type, but I can’t figure out how to abstract out the criteria that differs between the animal types.

Again, this is just an analogy because I don’t think my actual problem will make any sense to anyone else. What I need is just some pointers in the right direction, maybe a link or two. I just can’t seem to work out how to make this happen in Rails without creating a separate table for each criteria set, as in dog_criteria, cat_criteria, fish_criteria, and so on…

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

    In the software modeling world, this would obviously be done with a class for each species, I.E. “Dog”, “Cat”, “Fish” which extend “Animal”. In the relational database world, this becomes a bit harder to represent.

    If you wanted to match this object-oriented approach in your database, you would have a table for “Animals” and then a table for each species, “Cat”, “Dog”, and “Fish”. Then you would probably have a species table (or a hard-coded enum in your code) that would give you a value to place in the Animal row for which species each animal was. This would tell you how to look up further information for each animal.

    This is probably not the best approach. What you have is more what I would call “Custom Data” for each animal. You should define one table that has a list of custom attributes, and another table to match these attributes to a value for each animal row.

    If you’d like to make it more convenient to see and control which attributes can apply to which species you could make a third table for “Categories” which would link to the Animal species and to a collection of attributes. Then you would specify the category ID on the animal row.

    Sample tables:

    Animals
    -------
    ID
    Age
    Sex
    Species
    Breed
    
    Parameters
    ----------
    ID
    Name
    
    Parameter Values
    ----------------
    ParameterID
    AnimalID
    Value
    
    Categories (optional - add CategoryID to animals)
    ---------------------
    ID
    Name
    
    Category Parameters
    -------------------
    CategoryID
    ParameterID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, so i need to be able to match strings in ways that give
I need a regular expression able to match everything but a string starting with
I need to be able to create an id for a hyperlink. I have
I need to be able to match a certain string ( '[' then any
I need to be able to match strings like: GQG6VJ6K , TYTU-TIDM-56 , 4-5-P-Z
I need to index a k-d tree, and be able to match part of
I need to match all three types of comments that PHP might have: #
I have a string containing words that i need to match like the one
I need to be able to match a price value from a string given
Here is what I need to be able to do: I need to match

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.