#598 ✓resolved
Piotr Usewicz

Model.get(nil) returns an object instead of nil

Reported by Piotr Usewicz | October 16th, 2008 @ 07:20 AM



>> Operator.fixture {{ :name => '123', :code => 'xu' }}
=> [#<Proc:0x02775824@(irb):1>]

>> Operator.gen
 ~ INSERT INTO `operators` (`use_sms_billing`, `created_at`, `name`, `updated_at`, `code`) VALUES (FALSE, '2008-10-16 13:09:54', '123', '2008-10-16 13:09:54', 'xu')

>> Operator.get nil
 ~ SELECT `id`, `name`, `code`, `use_sms_billing`, `created_at`, `updated_at` FROM `operators` WHERE (`id` IS NULL) ORDER BY `id` LIMIT 1
=> #<Operator id=13 name="123" code="xu" use_sms_billing=false created_at=#<DateTime: 3927609611/1600,1/24,2299161> updated_at=#<DateTime: 3927609611/1600,1/24,2299161>>

After second invocation of Operator.get(nil), nil is returned properly.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages