Created
August 3, 2011 14:48
-
-
Save hoffmanc/1122805 to your computer and use it in GitHub Desktop.
Problems with awesome_nested_set
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
chris@ubuntu:~/hud-pinellas$ rails console | |
Loading development environment (Rails 3.0.9) | |
irb(main):001:0> task = TimesheetTask.where('parent_id is not null').first | |
=> #<TimesheetTask id: 11261534, name: "Community Meetings", description: "attendance at meetings with local service providers...", task_type: "Voucher", parent_id: 1065399318, created_at: "2011-07-08 15:48:17", updated_at: "2011-07-08 15:48:17", lft: nil, rgt: nil> | |
irb(main):002:0> task.ancestors | |
=> [] | |
irb(main):003:0> task.parent | |
=> #<TimesheetTask id: 1065399318, name: "Customer Service", description: nil, task_type: "Voucher", parent_id: 600959503, created_at: "2011-07-08 15:48:17", updated_at: "2011-07-08 15:48:17", lft: nil, rgt: nil> | |
irb(main):004:0> TimesheetTask.rebuild! | |
=> [#<TimesheetTask id: 36577376, name: "Special Programs (FSS, H, Other)", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 1, rgt: 34>, #<TimesheetTask id: 56366788, name: "Staff Meetings", description: nil, task_type: "NonVoucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 35, rgt: 36>, #<TimesheetTask id: 70374107, name: "Training", description: nil, task_type: "NonVoucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 37, rgt: 38>, #<TimesheetTask id: 214659149, name: "Receive and Process Interim Requests", description: "receive phone calls, walk in participants making in...", task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 39, rgt: 40>, #<TimesheetTask id: 225425048, name: "Supervisory", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 41, rgt: 48>, #<TimesheetTask id: 365969678, name: "Inspections", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 49, rgt: 54>, #<TimesheetTask id: 368900570, name: "Other", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 55, rgt: 60>, #<TimesheetTask id: 431023903, name: "Ongoing Occupancy", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 61, rgt: 102>, #<TimesheetTask id: 441796476, name: "Paid Time Off", description: nil, task_type: "NonVoucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 103, rgt: 104>, #<TimesheetTask id: 453757248, name: "Customer Service", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 105, rgt: 114>, #<TimesheetTask id: 490242915, name: "Breaks", description: nil, task_type: "NonVoucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 115, rgt: 116>, #<TimesheetTask id: 503595786, name: "Field Inspections", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 117, rgt: 146>, #<TimesheetTask id: 600959503, name: "Initial Occupancy", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 147, rgt: 208>, #<TimesheetTask id: 708817908, name: "Lunch", description: nil, task_type: "NonVoucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 209, rgt: 210>, #<TimesheetTask id: 859234896, name: "Filing", description: nil, task_type: "NonVoucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 211, rgt: 212>, #<TimesheetTask id: 878388825, name: "Research Administrative Tasks", description: nil, task_type: "NonVoucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 213, rgt: 214>, #<TimesheetTask id: 882994890, name: "Program Monitoring", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:38", lft: 215, rgt: 232>] | |
irb(main):005:0> task.ancestors | |
=> [] | |
irb(main):006:0> task = TimesheetTask.where('parent_idbislnot null').first | |
=> #<TimesheetTask id: 11261534, name: "Community Meetings", description: "attendance at meetings with local service providers...", task_type: "Voucher", parent_id: 1065399318, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 199, rgt: 200> | |
irb(main):007:0> task.ancestors | |
=> [#<TimesheetTask id: 600959503, name: "Initial Occupancy", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 147, rgt: 208>, #<TimesheetTask id: 1065399318, name: "Customer Service", description: nil, task_type: "Voucher", parent_id: 600959503, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 198, rgt: 207>] | |
irb(main):008:0> task.self_and_ancestors | |
=> [#<TimesheetTask id: 600959503, name: "Initial Occupancy", description: nil, task_type: "Voucher", parent_id: nil, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 147, rgt: 208>, #<TimesheetTask id: 1065399318, name: "Customer Service", description: nil, task_type: "Voucher", parent_id: 600959503, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 198, rgt: 207>, #<TimesheetTask id: 11261534, name: "Community Meetings", description: "attendance at meetings with local service providers...", task_type: "Voucher", parent_id: 1065399318, created_at: "2011-07-08 15:48:17", updated_at: "2011-08-03 14:59:37", lft: 199, rgt: 200>] | |
irb(main):009:0> exit | |
chris@ubuntu:~/hud-pinellas$ exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment