Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created November 11, 2008 22:16
Show Gist options
  • Select an option

  • Save jackdempsey/23994 to your computer and use it in GitHub Desktop.

Select an option

Save jackdempsey/23994 to your computer and use it in GitHub Desktop.
>> Gist.all.destroy!
~ DELETE FROM `gists`
=> true
>> Gist.create(:url => "test")
~ INSERT INTO `gists` (`updated_at`, `created_at`, `url`) VALUES ('2008-11-11 17:12:48', '2008-11-11 17:12:48', 'test')
=> #<Gist id=8 name=nil url="test" updated_at=#<DateTime: 2209304183/900,-5/24,2299161> created_at=#<DateTime: 2209304183/900,-5/24,2299161>>
>> Gist.get(1)
~ SELECT `id`, `name`, `url`, `updated_at`, `created_at` FROM `gists` WHERE (`id` = 1) ORDER BY `id` LIMIT 1
=> nil
>> Gist.get(1)
~ SELECT `id`, `name`, `url`, `updated_at`, `created_at` FROM `gists` WHERE (`id` = 1) ORDER BY `id` LIMIT 1
=> nil
>> Gist.get("this should not return an object")
~ SELECT `id`, `name`, `url`, `updated_at`, `created_at` FROM `gists` WHERE (`id` IS NULL) ORDER BY `id` LIMIT 1
=> #<Gist id=8 name=nil url="test" updated_at=#<DateTime: 2209304183/900,-5/24,2299161> created_at=#<DateTime: 2209304183/900,-5/24,2299161>>
>> Gist.get("this should not return an object and now won't")
~ SELECT `id`, `name`, `url`, `updated_at`, `created_at` FROM `gists` WHERE (`id` IS NULL) ORDER BY `id` LIMIT 1
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment