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
class Country < Neo4j::Rails::Model | |
property :name | |
ref_node { Neo4j.default_ref_node } | |
end |
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
class Tenant < Neo4j::Rails::Model | |
property :name | |
ref_node { Neo4j.default_ref_node } | |
after_create :create_default_data | |
def create_default_data | |
Neo4j.threadlocal_ref_node = self | |
load("#{Rails.root}/db/tenant_default_data.rb") |
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
class OrdersController < ApplicationController | |
before_filter :authenticate_user!, :ensure_tenant_setup! | |
protected | |
def ensure_tenant_setup! | |
Neo4j.threadlocal_ref_node = current_user.tenant | |
end | |
end |
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
instance.version(version_number) |
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
instance.revert_to(version_number) |
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
class MaxVersionModel < Neo4j::Rails::Model | |
include Neo4j::Rails::Versioning | |
max_versions 2 | |
end |
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
class VersionableModel < Neo4j::Rails::Model | |
include Neo4j::Rails::Versioning | |
end |
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
class SportsCar < Neo4j::Rails::Model | |
include Neo4j::Rails::Versioning | |
property :brand | |
end | |
class Driver < Neo4j::Rails::Model | |
include Neo4j::Rails::Versioning | |
property :name | |
has_n(:sports_cars) | |
end |
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
driver.version(3).outgoing(:sports_cars) #Returns two cars as expected |
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
driver = Driver.create(:name => 'Walter Plinge') |
OlderNewer