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
  • Interval

Interval · Changes

Page history
Updated Interval (markdown) authored Apr 12, 2017 by Carlos's avatar Carlos
Show whitespace changes
Inline Side-by-side
Interval.md
View page @ 964ff0c4
...@@ -24,3 +24,15 @@ The column is automatically identified and the value is turned into `ActiveSuppo ...@@ -24,3 +24,15 @@ The column is automatically identified and the value is turned into `ActiveSuppo
# Shows when you'll be finishing the course # Shows when you'll be finishing the course
course.duration.from_now course.duration.from_now
``` ```
The value can be set in different manners:
```ruby
course.duration = 1.year # A new instance of ActiveSupport::Duration
course.duration = [1, 2, 3, 4, 5, 6] # A list of values for the given order Y-M-D H:M:S
course.duration = [1, 0, 0] # The list uses the right-most available positions, so this is H:M:S
course.duration = {days: 1, hours: 6} # You can use complex hash notation
course.duration = 'P1Y2M3DT4H5M6S' # It accepts ISO 8601 format, so form fields can cast to this type
course.duration = 259200
course.duration.parts.to_h == {days: 3} # It also converts any set value to the correct separated duration
```
\ No newline at end of file
Clone repository
  • Wiki
  • Configuring

Data types

  • Enum
  • Interval

Querying

  • Distinct On
  • Auxiliary Statements