The more I jutted into the wonderful world of ruby, I found more and more weary to manage CoreData API. Everytime you want to create a simple query, you need to define the request, the predicate and the sorting descriptors.

This could be an example query to retrieve people sorted by name:

[cc lang=”objc”]
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@”Person”];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@”1==1″];
[request setPredicate:predicate];

NSSortDescriptor * firstNameSort = [[NSSortDescriptor alloc] initWithKey:@”first_name” ascending:YES];
request.sortDescriptors = @[firstNameSort]];

NSError *error = nil;
NSArray *people = [context executeFetchRequest:request error:&error];
[/cc]

MagicalRecord instead, integrates active record pattern like in Rails and I think the difference is remarkable:

[cc lang=”objc]
NSPredicate *predicate = [NSPredicate predicateWithFormat:@”1==1″];
NSArray *people = [Person findAllSortedBy:@”first_name” ascending:YES withPredicate:predicate]
[/cc]

MagicalRecord at Github