Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use the new boss_db:find/3 API

  • Loading branch information...
commit 3951cdd18978409e901d42f9aab2ded4860bca96 1 parent f7e145a
Evan Miller authored July 22, 2012
5  src/controller/cb_admin_model_controller.erl
@@ -31,7 +31,8 @@ model('GET', [ModelName, PageName], Authorization) ->
31 31
     Page = list_to_integer(PageName),
32 32
     Model = list_to_atom(ModelName),
33 33
     RecordCount = boss_db:count(Model),
34  
-    Records = boss_db:find(Model, [], ?RECORDS_PER_PAGE, (Page - 1) * ?RECORDS_PER_PAGE, id, str_descending),
  34
+    Records = boss_db:find(Model, [], [{limit, ?RECORDS_PER_PAGE}, 
  35
+            {offset, (Page - 1) * ?RECORDS_PER_PAGE}, descending]),
35 36
     TopicString = string:join(lists:map(fun(Record) -> Record:id() ++ ".*" end, Records), ", "),
36 37
     AttributesWithDataTypes = lists:map(fun(Record) ->
37 38
                 {Record:id(), lists:map(fun({Key, Val}) ->
@@ -52,7 +53,7 @@ model('GET', [ModelName, PageName], Authorization) ->
52 53
 
53 54
 csv('GET', [ModelName], Authorization) ->
54 55
     Model = list_to_atom(ModelName),
55  
-    [First|_] = Records = boss_db:find(Model, [], all, 0, id, str_descending),
  56
+    [First|_] = Records = boss_db:find(Model, [], [descending]),
56 57
     FirstLine = [lists:foldr(fun
57 58
                 (Attr, []) ->
58 59
                     [atom_to_list(Attr)];

0 notes on commit 3951cdd

Please sign in to comment.
Something went wrong with that request. Please try again.