SHARE
TWEET

Untitled

a guest Mar 17th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. > Fun::Movie.eager_graph(:schedules)
  2.  ~ SELECT * FROM `fun_events` WHERE (`type` = 'Fun::Movie') LIMIT 1
  3. # type comes from set_dataset dataset.filter {:type == self.name}, this one is STI
  4.  
  5.  
  6.  ~ SELECT * FROM `fun_schedule` LIMIT 1
  7. => #<Sequel::MySQL::Dataset: "SELECT `fun_events`.`id`, `fun_events`.`title`, `fun_events`.`slug`, `fun_events`.`thumbnail_small`, `fun_events`.`thumbnail_large`, `fun_events`.`description`, `fun_events`.`description_html`, `fun_events`.`meta1`, `fun_events`.`meta2`, `fun_events`.`meta3`, `fun_events`.`meta4`, `fun_events`.`meta5`, `fun_events`.`type`, `fun_events`.`created_at`, `schedules`.`id` AS `schedules_id`, `schedules`.`event_id`, `schedules`.`place_id`, `schedules`.`happens_at` FROM `fun_events` LEFT OUTER JOIN `fun_schedule` `schedules` ON (`schedules`.`event_id` = `fun_events`.`id`) WHERE (`type` = 'Fun::Movie')">
  8. >> z = _
  9. => #<Sequel::MySQL::Dataset: "SELECT `fun_events`.`id`, `fun_events`.`title`, `fun_events`.`slug`, `fun_events`.`thumbnail_small`, `fun_events`.`thumbnail_large`, `fun_events`.`description`, `fun_events`.`description_html`, `fun_events`.`meta1`, `fun_events`.`meta2`, `fun_events`.`meta3`, `fun_events`.`meta4`, `fun_events`.`meta5`, `fun_events`.`type`, `fun_events`.`created_at`, `schedules`.`id` AS `schedules_id`, `schedules`.`event_id`, `schedules`.`place_id`, `schedules`.`happens_at` FROM `fun_events` LEFT OUTER JOIN `fun_schedule` `schedules` ON (`schedules`.`event_id` = `fun_events`.`id`) WHERE (`type` = 'Fun::Movie')">
  10. >> z.count
  11.  ~ SELECT COUNT(*) FROM `fun_events` LEFT OUTER JOIN `fun_schedule` `schedules` ON (`schedules`.`event_id` = `fun_events`.`id`) WHERE (`type` = 'Fun::Movie') LIMIT 1
  12. => 0
  13.  #however! The exact same SQL query in CocoaMYSQL returns 314 in a single cell.
  14.  
  15.  
  16. >> z.all.size
  17.  ~ SELECT `fun_events`.`id`, `fun_events`.`title`, `fun_events`.`slug`, `fun_events`.`thumbnail_small`, `fun_events`.`thumbnail_large`, `fun_events`.`description`, `fun_events`.`description_html`, `fun_events`.`meta1`, `fun_events`.`meta2`, `fun_events`.`meta3`, `fun_events`.`meta4`, `fun_events`.`meta5`, `fun_events`.`type`, `fun_events`.`created_at`, `schedules`.`id` AS `schedules_id`, `schedules`.`event_id`, `schedules`.`place_id`, `schedules`.`happens_at` FROM `fun_events` LEFT OUTER JOIN `fun_schedule` `schedules` ON (`schedules`.`event_id` = `fun_events`.`id`) WHERE (`type` = 'Fun::Movie')
  18. => 9
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top