Sha256: bca6c8b86fc0ec844f5ad1b7b6a3130c756589e7eb6f873a8115afd7d3d72af4
Contents?: true
Size: 1.49 KB
Versions: 4
Compression:
Stored size: 1.49 KB
Contents
#The user class is just sharded, not replicated class User < ActiveRecord::Base def awesome_queries Octopus.using(:canada) do User.create(:name => "teste") end end end #The client class isn't replicated class Client < ActiveRecord::Base has_many :items has_many :comments, :as => :commentable end #This class is replicated class Cat < ActiveRecord::Base replicated_model() #sharded_model() end #This class sets its own connection class CustomConnection < ActiveRecord::Base octopus_establish_connection(:adapter => "mysql", :database => "octopus_shard2", :username => "root", :password => "") end #This items belongs to a client class Item < ActiveRecord::Base belongs_to :client has_many :parts end class Part < ActiveRecord::Base belongs_to :item end class Keyboard < ActiveRecord::Base replicated_model validates_uniqueness_of :name belongs_to :computer end class Computer < ActiveRecord::Base has_one :keyboard end class Role < ActiveRecord::Base has_and_belongs_to_many :permissions end class Permission < ActiveRecord::Base has_and_belongs_to_many :roles end class Assignment < ActiveRecord::Base belongs_to :programmer belongs_to :project end class Programmer < ActiveRecord::Base has_many :assignments has_many :projects, :through => :assignments end class Project < ActiveRecord::Base has_many :assignments has_many :programmers, :through => :assignments end class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ar-octopus-0.3.4 | spec/database_models.rb |
ar-octopus-0.3.3 | spec/database_models.rb |
ar-octopus-0.3.2 | spec/database_models.rb |
ar-octopus-0.3.1 | spec/database_models.rb |