mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-25 12:45:32 +00:00
Merge pull request #416 from realm/al-ignored
Allow setting of non-persisted properties
This commit is contained in:
commit
513c0fee77
@ -18,6 +18,7 @@
|
|||||||
* Accessing an invalidated Results snapshot throws a JS exception rather than crashing
|
* Accessing an invalidated Results snapshot throws a JS exception rather than crashing
|
||||||
* Fix for error message when specifying properties with invalid object types
|
* Fix for error message when specifying properties with invalid object types
|
||||||
* Fix memory leak when reloading an app in debug mode
|
* Fix memory leak when reloading an app in debug mode
|
||||||
|
* Setting non-persisted properties now works as expected
|
||||||
|
|
||||||
0.11.1 Release notes (2016-3-29)
|
0.11.1 Release notes (2016-3-29)
|
||||||
=============================================================
|
=============================================================
|
||||||
|
@ -110,7 +110,12 @@ void RealmObject<T>::get_property(ContextType ctx, ObjectType object, const Stri
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
bool RealmObject<T>::set_property(ContextType ctx, ObjectType object, const String &property, ValueType value) {
|
bool RealmObject<T>::set_property(ContextType ctx, ObjectType object, const String &property, ValueType value) {
|
||||||
auto realm_object = get_internal<T, RealmObjectClass<T>>(object);
|
auto realm_object = get_internal<T, RealmObjectClass<T>>(object);
|
||||||
realm_object->set_property_value(ctx, property, value, true);
|
try {
|
||||||
|
realm_object->set_property_value(ctx, property, value, true);
|
||||||
|
}
|
||||||
|
catch (InvalidPropertyException &ex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,4 +456,17 @@ module.exports = BaseTest.extend({
|
|||||||
obj.doubleCol;
|
obj.doubleCol;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testIgnoredProperties: function() {
|
||||||
|
var realm = new Realm({schema: [schemas.TestObject]});
|
||||||
|
var obj;
|
||||||
|
realm.write(function() {
|
||||||
|
obj = realm.create('TestObject', {doubleCol: 1, ignored: true});
|
||||||
|
});
|
||||||
|
|
||||||
|
TestCase.assertEqual(obj.doubleCol, 1);
|
||||||
|
TestCase.assertEqual(obj.ignored, undefined);
|
||||||
|
obj.ignored = true;
|
||||||
|
TestCase.assertEqual(obj.ignored, true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user