Created
February 4, 2009 12:31
-
-
Save somebee/58073 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
order = Order.new(:company => company) | |
order.events >> | |
Wed, 04 Feb 2009 12:29:46 GMT ~ debug ~ (0.000211) SELECT `id`, `type`, `order_id`, `details`, `body` FROM `events` WHERE `order_id` IS NULL ORDER BY `id` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> order = Order.create | |
=> #<Order id=107912 ... > | |
>> event = order.events.new(:type => OrderEvent) | |
=> #<Event id=nil type=OrderEvent order_id=107912 ...> | |
>> event.order_id | |
=> 107912 | |
>> event.save | |
=> true | |
>> event.order_id | |
=> 107912 | |
>> event.reload | |
=> #<Event id=32 type=OrderEvent at=#<DateTime: 53025127771/21600,1/24,2299161> order_id=nil ...> | |
>> event.order_id | |
=> nil | |
SQL: | |
~ debug ~ (0.000071) SET SESSION sql_mode = 'ANSI,NO_AUTO_VALUE_ON_ZERO,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION,TRADITIONAL' | |
~ debug ~ (0.001257) INSERT INTO `orders` (`created_at`) VALUES ('2009-02-04 13:37:41') | |
~ debug ~ (0.062815) INSERT INTO `events` (`type`, `at`) VALUES ('OrderEvent', '2009-02-04 13:38:04') | |
~ debug ~ (0.047902) SELECT `id`, `type`, `at`, `title`, `order_id`, ... FROM `events` WHERE `id` = 32 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment