Skip to content

Instantly share code, notes, and snippets.

View kovacs's full-sized avatar

Michael Kovacs kovacs

  • San Francisco, CA
  • X @mk
View GitHub Profile
One other cause is your :dependent callbacks.
class Blog < AR::Base
has_many :posts, :dependent => :destroy
end
This will iterate through every post and call #destroy on it. Use :delete_all if you want to just issue a single delete query. HOWEVER, this won't hit your destroy callbacks on Post.
class Blog < AR::Base
has_many :posts
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
foo
bar
baz