草庐IT

ruby-on-rails - rails : Ordering parents by grand children's attribute

classUserhas_many:calendarshas_many:cars,through::calendarsendclassCalendarhas_many:carsendclassCar#attribute`issued_at`end我需要通过issued_at向用户订购他的汽车。因此,通过孙子的属性issued_at对父级进行排序。到目前为止:@q=User.active.joins(:cars).order('cars.issued_at').group('users.id')但是我得到了column"cars.issued_at"mustappearintheGROU

iphone - Grand Central Dispatch (GCD) 与 performSelector - 需要更好的解释

我在我的应用程序中同时使用了GCD和performSelectorOnMainThread:waitUntilDone,并且倾向于认为它们可以互换——也就是说,performSelectorOnMainThread:waitUntilDone是对GCDC语法的Obj-C包装器。我一直认为这两个命令是等效的:dispatch_sync(dispatch_get_main_queue(),^{[selfdoit:YES];});[selfperformSelectorOnMainThread:@selector(doit:)withObject:YESwaitUntilDone:YES];

iphone - Grand Central Dispatch (GCD) 与 performSelector - 需要更好的解释

我在我的应用程序中同时使用了GCD和performSelectorOnMainThread:waitUntilDone,并且倾向于认为它们可以互换——也就是说,performSelectorOnMainThread:waitUntilDone是对GCDC语法的Obj-C包装器。我一直认为这两个命令是等效的:dispatch_sync(dispatch_get_main_queue(),^{[selfdoit:YES];});[selfperformSelectorOnMainThread:@selector(doit:)withObject:YESwaitUntilDone:YES];