Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T torque-postgresql
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Carlos
  • torque-postgresql
  • Wiki
  • Inherited Tables

Inherited Tables · Changes

Page history
Updated Inherited Tables (markdown) authored Aug 18, 2019 by Carlos's avatar Carlos
Hide whitespace changes
Inline Side-by-side
Inherited-Tables.md
View page @ 426d1d4e
> Tired of `polymorphic` or the infamous `type` column. Well, **NERVER MORE!!!**
This is one great feature from PostgreSQL, the ability of having a table with the most generic data, and then many other tables with the information necessary only for that specifi type of the main one. Rails do allow us to do that, using the `type` attribute, but its biggest problem is that columns from different types ended up getting mixed together. [PostgreSQL Docs](https://www.postgresql.org/docs/9.6/static/ddl-inherit.html)
This is one great feature from PostgreSQL, the ability to have a table with the most generic data, and then many other tables with the information necessary only for that specific type of the main one. Rails do allow us to do that, using the `type` attribute, but its biggest problem is that columns from different types ended up getting mixed together. [PostgreSQL Docs](https://www.postgresql.org/docs/9.6/static/ddl-inherit.html)
This will allow you do work with inherited models as they are separated tables but yet sharing methods, scopes, validations, and all the other features from all the super models.
This will allow you to work with inherited models as they are separated tables but yet sharing methods, scopes, validations, and all the other features from all the super models.
**CAUTION** PostgreSQL has some [**caveats**](https://www.postgresql.org/docs/9.1/static/ddl-inherit.html#DDL-INHERIT-CAVEATS) while using this resource. They will be address in later versions of this GEM.
**CAUTION** PostgreSQL has some [**caveats**](https://www.postgresql.org/docs/9.1/static/ddl-inherit.html#DDL-INHERIT-CAVEATS) while using this resource. They will be addressed in later versions of this GEM.
# How it works
......
Clone repository
  • Wiki
  • Configuring

Core Extensions

  • Range

Data types

  • Enum
  • Enum Set
  • Interval
  • Date/Time Range
  • Box
  • Circle
  • Line
  • Segment

Querying

  • Arel
  • Has Many
  • Belongs to Many
  • Dynamic Attributes
  • Distinct On
  • Auxiliary Statements
  • Inherited Tables