Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Altered float check to also check for double
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-panchal committed Jun 17, 2015
1 parent a3e7870 commit 5b16639
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/NSManagedObject+ActiveRecord.m
Expand Up @@ -372,7 +372,7 @@ - (void)setSafeValue:(id)value forKey:(NSString *)key {
else if (attributeType == NSBooleanAttributeType)
value = [NSNumber numberWithBool:[value boolValue]];

else if (attributeType == NSFloatAttributeType)
else if ([self isFloatAttributeType:attributeType])
value = [NSNumber numberWithDouble:[value doubleValue]];

else if (attributeType == NSDateAttributeType)
Expand All @@ -388,6 +388,11 @@ - (BOOL)isIntegerAttributeType:(NSAttributeType)attributeType {
(attributeType == NSInteger64AttributeType);
}

- (BOOL)isFloatAttributeType:(NSAttributeType)attributeType {
return (attributeType == NSFloatAttributeType) ||
(attributeType == NSDoubleAttributeType);
}

#pragma mark - Date Formatting

- (NSDateFormatter *)defaultFormatter {
Expand Down

0 comments on commit 5b16639

Please sign in to comment.