Closed paulocoutinhox closed 11 years ago
Could you explain on which step have you seen this behavior? e.g. file name + line, or function name...
My DB class:
@interface MyProductChapter : ActiveRecord
@property (nonatomic, retain) NSNumber *chapter_id;
@property (nonatomic, retain) NSString *object;
@property (nonatomic, retain) NSNumber *object_id;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *file_url;
The example method:
+ (MyProductChapter *)findFirstForObjectAndObjectId:(NSString *)object : (NSNumber *)objectId
{
ARLazyFetcher *fetcherChapters = [MyProductChapter lazyFetcher];
[fetcherChapters where:@"object = %@ AND object_id = %@", object, objectId, nil];
[fetcherChapters limit:1];
[fetcherChapters offset:0];
[fetcherChapters orderBy:@"id"];
NSArray *chapters = [fetcherChapters fetchRecords];
if ([chapters count] > 0)
{
MyProductChapter *chapter = [chapters objectAtIndex:0];
// the line below convert the NSString value to NSInteger, because "chapter.object_id" is NSNumber, but come as NSString from "ARLazyFetcher".
//chapter.chapter_id = [NSNumber numberWithInteger: [chapter.object_id integerValue]];
return chapter;
}
return nil;
}
Cannot reproduce.
All records have a property NSNumber *id
and it works fine.
I will make an example.
Would be great :+1:
Hi,
I found a small problem when you fetch data from database, and the column is "NSNumber".
Instead of come a "NSNumber" with a "int" value, it come with a "NSString" value.
You need have a field that is NSNumber. Insert any data and retrieve. When you debug and inspect the column that you retrive, you will see @"1", instead of 1 (int).