Sha256: 60385ace92b11152c697bb633992fe2901c7b66371a76c961388418aade7a509

Contents?: true

Size: 1.04 KB

Versions: 25

Compression:

Stored size: 1.04 KB

Contents

require 'sqlite3'
require 'dm-core'
require 'dm-core/support/logger'
require 'dm-migrations'

DataMapper.setup :default, 'sqlite3::memory:'

# Define models
class Animal
  include DataMapper::Resource
  property :id, Serial
  property :name, String
  property :notes, Text
 
  def self.setup
    Animal.create(:name => 'Dog', :notes => "Man's best friend")
    Animal.create(:name => 'Cat', :notes => "Woman's best friend")
    Animal.create(:name => 'Lion', :notes => 'King of the Jungle')
  end
end

class Ownership
  include DataMapper::Resource

  belongs_to :animal, :key => true
  belongs_to :human, :key => true

  def self.setup
  end
end

class Human
  include DataMapper::Resource

  property :id, Serial
  property :name, String

  has n, :ownerships
  has 1, :pet, :model => 'Animal', :through => :ownerships, :via => :animal

  def self.setup
  end
end

# Load fixtures
[Animal, Ownership, Human].each do |klass|
  klass.auto_migrate!
  klass.setup
end

if 'irb' == $0
  DataMapper.logger.set_log($stdout, :debug)
  DataMapper.logger.auto_flush = true
end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
will_paginate-3.3.0 spec/finders/data_mapper_test_connector.rb
will_paginate-3.2.1 spec/finders/data_mapper_test_connector.rb
will_paginate-3.2.0 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.8 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.7 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.6 spec/finders/data_mapper_test_connector.rb
will_paginate-3.0.12 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.5 spec/finders/data_mapper_test_connector.rb
will_paginate-3.0.11 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.3 spec/finders/data_mapper_test_connector.rb
will_paginate-3.0.10 spec/finders/data_mapper_test_connector.rb
will_paginate-3.0.9 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.2 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.1 spec/finders/data_mapper_test_connector.rb
will_paginate-3.0.8 spec/finders/data_mapper_test_connector.rb
will_paginate-3.1.0 spec/finders/data_mapper_test_connector.rb
will_paginate_seo-3.0.4 spec/finders/data_mapper_test_connector.rb
will_paginate-3.0.7 spec/finders/data_mapper_test_connector.rb
will_paginate-3.0.6 spec/finders/data_mapper_test_connector.rb
hobo_will_paginate-2.1.1 spec/finders/data_mapper_test_connector.rb