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
  • Enum Set

Enum Set · Changes

Page history
Updated Enum Set (markdown) authored Apr 01, 2022 by Carlos's avatar Carlos
Hide whitespace changes
Inline Side-by-side
Enum-Set.md
View page @ a1cb64a6
...@@ -15,7 +15,8 @@ Just as a reference, we will be using this table for the examples: ...@@ -15,7 +15,8 @@ Just as a reference, we will be using this table for the examples:
```ruby ```ruby
create_table :posts do |t| create_table :posts do |t|
t.string :title t.string :title
t.permissions :creator_permissions, array: true t.permissions :creator_permissions, array: true # ONLY RAILS < 7.0
t.enum :creator_permissions, enum_type: :creator_permissions, array: true # ONLY RAILS >= 7.0
end end
``` ```
...@@ -59,7 +60,7 @@ You have to go to each of your models and enable the functionality for each enum ...@@ -59,7 +60,7 @@ You have to go to each of your models and enable the functionality for each enum
```ruby ```ruby
# models/user.rb # models/user.rb
class Post < ActiveRecord::Base class Post < ActiveRecord::Base
enum_set :creator_permissions torque_enum_set :creator_permissions
end end
``` ```
......
Clone repository
  • Wiki
  • Configuring

Data types

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

Querying

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