Sha256: 8552dd30bc999d2250ff28808dcbd9289a48db540fe0f3bd8603bd4d73fa8f85
Contents?: true
Size: 945 Bytes
Versions: 3
Compression:
Stored size: 945 Bytes
Contents
require 'acts_as_paranoid_dag' # This is the required database structure. ActiveRecord::Schema.define( :version => 1 ) do create_table :users, force: true do |t| t.string :name end create_table :groups, force: true do |t| t.string :name end create_table :dag_links, force: true do |t| t.integer :ancestor_id t.string :ancestor_type t.integer :descendant_id t.string :descendant_type t.boolean :direct t.integer :count t.datetime :deleted_at t.timestamps end end # This is how to include the functionality in the models. class DagLink < ActiveRecord::Base acts_as_dag_links polymorphic: true, paranoid: true end class User < ActiveRecord::Base has_dag_links link_class_name: "DagLink", ancestor_class_names: %w(Group) end class Group < ActiveRecord::Base has_dag_links link_class_name: "DagLink", ancestor_class_names: %w(Group), descendant_class_names: %w(Group User) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
acts_as_paranoid_dag-0.0.3 | spec/support/schema.rb |
acts_as_paranoid_dag-0.0.2 | spec/support/schema.rb |
acts_as_paranoid_dag-0.0.1 | spec/support/schema.rb |