daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'rubygems'
  2. require 'dm-core'
  3. require 'dm-constraints'
  4.  
  5. DataMapper::Logger.new(STDOUT, :debug)
  6. DataMapper.setup(:default, 'mysql://localhost/dm_core_test')
  7.  
  8. class Comment
  9.   include DataMapper::Resource
  10.  
  11.   property :id,          Serial
  12.   property :name,        String
  13.  
  14.   has n, :categories, :through => Resource, :constraint => :destroy!
  15.  
  16. end
  17.  
  18. class Category
  19.   include DataMapper::Resource
  20.  
  21.   property :id,          Serial
  22.   property :name,        String
  23.  
  24.   has n, :comments, :through => Resource, :constraint => :destroy!
  25.  
  26. end
  27.  
  28. DataMapper.auto_migrate!
  29. DataMapper.auto_migrate!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top