Sha256: 3540e73b8638791c2a8d82539980b1573f3c5e47ef81d0c39d8c109047bc2a6a

Contents?: true

Size: 906 Bytes

Versions: 6

Compression:

Stored size: 906 Bytes

Contents

ActiveRecord::Schema.define do
  create_table :users, :force => true do |t|
    t.string :name
  end

  create_table :posts_users, :id => false, :force => true do |t|
    t.references :user, :null => false
    t.references :post, :null => false
  end

  create_table :posts, :force => true do |t|
    t.string :content
  end

  create_table :connections, :force => true do |t|
    t.references :user
    t.references :friend
  end

  create_table :friends, :force => true do |t|
    t.string :type
  end
end

class User < ActiveRecord::Base
  has_and_belongs_to_many :posts
  has_many :connections
  has_many :friends, :through => :connections
end

class Post < ActiveRecord::Base
  has_and_belongs_to_many :users
end

class Connection < ActiveRecord::Base
  has_many :friends
  has_many :users
end

class Friend < ActiveRecord::Base
  has_many :connections
  has_many :users, :through => :connections
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
m2m_fast_insert-0.2.1 spec/support/test_model.rb
m2m_fast_insert-0.2.0 spec/support/test_model.rb
m2m_fast_insert-0.1.0 spec/support/test_model.rb
m2m_fast_insert-0.0.3 spec/support/test_model.rb
m2m_fast_insert-0.0.2 spec/support/test_model.rb
m2m_fast_insert-0.0.1 spec/support/test_model.rb