-
-
Save arifikhsan/6fe9319b1dc8cf746456f65cb490497e to your computer and use it in GitHub Desktop.
Setting up Ahoy models to use a separate datastore
This file contains hidden or 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
| module Ahoy | |
| class AhoyBase < ActiveRecord::Base | |
| establish_connection DB_STATS | |
| self.abstract_class = true | |
| end | |
| end |
This file contains hidden or 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
| module Ahoy | |
| class Event < AhoyBase | |
| include Ahoy::Properties | |
| self.table_name = "ahoy_events" | |
| belongs_to :visit | |
| belongs_to :user, optional: true | |
| end | |
| end |
This file contains hidden or 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
| class Visit < Ahoy::AhoyBase | |
| has_many :ahoy_events, class_name: "Ahoy::Event" | |
| belongs_to :user, optional: true | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment