Skip to content

Instantly share code, notes, and snippets.

@loe
Created October 6, 2008 18:30
Show Gist options
  • Save loe/15091 to your computer and use it in GitHub Desktop.
Save loe/15091 to your computer and use it in GitHub Desktop.
>> n = Notification.find(:first, :include => [{:event, :target}], :order => 'id DESC')
Notification Load (0.000361) SELECT * FROM `notifications` ORDER BY id DESC LIMIT 1
Event Load (0.000306) SELECT * FROM `events` WHERE (`events`.`id` IN (45))
ActivityItem Load (0.000320) SELECT * FROM `activity_items` WHERE (`activity_items`.`id` IN (3))
=> #<Notification id: 28, event_id: 45, user_id: 3, sent: false, created_at: "2008-10-03 21:58:52", updated_at: "2008-10-03 21:58:52", subscription_id: 1>
>> n.event.target
=> #<Event id: 45, created_at: "2008-10-03 21:58:52", deleted: nil, info: "", detail: "<subject>$0</subject> <predicate>updated</predicate...", event_category_id: nil, system_only: false, verb: "update", actor_type: "User", actor_id: 3, target_type: "ActivityItem", target_id: 3, obfuscated_id: "395adf80f8ba3cf9a63e07e5f129db84249ebef5", notifications_made: true, owner_id: nil, owner_type: nil, updated_at: "2008-10-03 21:58:52">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment