siuying / NanoStoreInMotion

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

How to sort without params #32

Closed dkrusenstrahle closed 11 years ago

dkrusenstrahle commented 11 years ago

Hello,

How can I sort a query without params? This does not work (sorting is not working):

Project.all({:sort => {:created_at => :desc}})

Nor this:

Project.find({:sort => {:created_at => :desc}})

This works however I have no param to include. I just want to get all records and sort them:

Project.find({:project => @project },{:sort => {:created_at => :desc}})

siuying commented 11 years ago

You might want to use Model#all https://github.com/siuying/NanoStoreInMotion/blob/master/spec/finder_spec.rb#L187

dkrusenstrahle commented 11 years ago

Yes thanks but like I said in the question I tried this and no sorting is done:

Project.all({:sort => {:created_at => :desc}})

siuying commented 11 years ago

That should work as the test do pass. If it does not work for you, can you create a simple test case that show the issue?

siuying commented 11 years ago

Close due to lack of response. If you believe there is indeed problem in the code base, please supply more info. Thanks!