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, 2018 by Carlos's avatar Carlos
Hide whitespace changes
Inline Side-by-side
Inherited-Tables.md
View page @ 073db914
...@@ -28,6 +28,24 @@ create_table "activity_posts", inherits: :activities do |t| ...@@ -28,6 +28,24 @@ create_table "activity_posts", inherits: :activities do |t|
end end
``` ```
### Models
In other to have your models working correctly and take fully advantage of this feature, the same way the tables are inherited, the models need to be inherited as well.
```ruby
# models/activity.rb
class Activity < ApplicationRecord
end
# models/activity_book.rb
class ActivityBook < Activity
end
# models/activity_post.rb
class ActivityPost < Activity
end
```
### Querying ### Querying
#### Single record #### Single record
......
Clone repository
  • Wiki
  • Configuring

Data types

  • Enum
  • Interval

Querying

  • Dynamic Attributes
  • Distinct On
  • Auxiliary Statements
  • Inherited Tables