Skip to content

Commit

Permalink
Document module
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatas committed Sep 6, 2024
1 parent 4d6c60d commit 9cfdd02
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ You may isolate your hypertables in another database, so, creating an abstract
layer for your hypertables is a good idea:

```ruby
class TimescaledbModel < ActiveRecord::Base
class Hypertable < ActiveRecord::Base
self.abstract_class = true

extend Timescaledb::ActsAsHypertable
Expand All @@ -352,7 +352,19 @@ end
And then, you can inherit from this model:

```ruby
class Event < TimescaledbModel
class Event < Hypertable
acts_as_hypertable time_column: "time"
end
```

Or you can include only when you're going to use them:

```ruby
class Event < ActiveRecord::Base
extend Timescaledb::ActsAsHypertable

establish_connection :timescaledb

acts_as_hypertable time_column: "time"
end
```
Expand Down

0 comments on commit 9cfdd02

Please sign in to comment.