Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Category
- include DataMapper::Resource
- property :id, Serial
- property :name, String
- has n, :categories, :through => Resource, :constraint => :destroy!
- end
- class Category
- include DataMapper::Resource
- property :id, Serial
- property :name, String
- has n, :comments, :through => Resource, :constraint => :destroy!
- end
- # On MySQL
- rake db:automigrate # First run works fine
- rake db:automigrate # Run it again and it blows up with "Cannot delete or update a parent row: a foreign key constraint fails (code: 1217, sql state: 23000, query: DROP TABLE IF EXISTS "categories")"
Add Comment
Please, Sign In to add comment