-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close #231
- Loading branch information
Showing
2 changed files
with
32 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module ChronoModel | ||
# A module to add to ActiveRecord::Base to check if they are backed by | ||
# temporal tables. | ||
module Chrono | ||
# Checks whether this Active Record model is backed by a temporal table | ||
# | ||
# @return [Boolean] false if the connection does not respond to is_chrono? | ||
# the result of connection.is_chrono?(table_name) otherwise | ||
def chrono? | ||
return false unless connection.respond_to? :is_chrono? | ||
|
||
connection.is_chrono?(table_name) | ||
end | ||
end | ||
end |