siuying / NanoStoreInMotion

RubyMotion wrapper for NanoStore, a lightweight schema-less key-value document database based on sqlite.
Other
103 stars 24 forks source link

Save after update is not persisted. #30

Closed dkrusenstrahle closed 11 years ago

dkrusenstrahle commented 11 years ago

Hello,

When I save record and then tries to update it I get no errors but it is not persisted.

tasks = Task.find(:id, NSFEqualTo, task).first tasks.track_time = "end" tasks.save

If I check p.track_time I get the correct value. But if I for example does this in Repl or other place in the app I get the original value and not the changed value.

tasks = Task.find(:id, NSFEqualTo, task).first tasks.track_time => start

siuying commented 11 years ago

Have you set the store save_interval to some other values? Also, you might get more information by NanoStore.debug = true, that will print more information and give you more insights what is being done.

If that didnt help, please try to clone the NanoStoreInMotion project and add a test case to demonstrate the issue. If it is not possible, try to create a minimal app that reproduce the issue.

dkrusenstrahle commented 11 years ago

What do you mean by "Have you set the store save_interval to some other values"? Debug prints a lot of information.

siuying commented 11 years ago

You'll need to set a default store (or per model store) before save anything. A store can have a save_interval setting that cause the store to do batch saving. (check README and the spec to see the usage)

Yes it prints a lot of information. Thats why a minimal test case / example that reproduce the issue is important.

dkrusenstrahle commented 11 years ago

I added this to the appdelegate. Nothing more. It works to create, delete and find data from the DB but when I want to update a record it does not store it permanently. Strange thing is that it works to update in REPL.

NanoStore.shared_store = NanoStore.store(:file, App.documents_path + "/nano.db")

siuying commented 11 years ago

With the information provided I cannot tell where's the problem. Can you show a repeatable test case or minimal sample app?

siuying commented 11 years ago

Close due to lack of feedback.