Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use the new boss_db:find/3 API

  • Loading branch information...
commit 3951cdd18978409e901d42f9aab2ded4860bca96 1 parent f7e145a
@evanmiller evanmiller authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/controller/cb_admin_model_controller.erl
View
5 src/controller/cb_admin_model_controller.erl
@@ -31,7 +31,8 @@ model('GET', [ModelName, PageName], Authorization) ->
Page = list_to_integer(PageName),
Model = list_to_atom(ModelName),
RecordCount = boss_db:count(Model),
- Records = boss_db:find(Model, [], ?RECORDS_PER_PAGE, (Page - 1) * ?RECORDS_PER_PAGE, id, str_descending),
+ Records = boss_db:find(Model, [], [{limit, ?RECORDS_PER_PAGE},
+ {offset, (Page - 1) * ?RECORDS_PER_PAGE}, descending]),
TopicString = string:join(lists:map(fun(Record) -> Record:id() ++ ".*" end, Records), ", "),
AttributesWithDataTypes = lists:map(fun(Record) ->
{Record:id(), lists:map(fun({Key, Val}) ->
@@ -52,7 +53,7 @@ model('GET', [ModelName, PageName], Authorization) ->
csv('GET', [ModelName], Authorization) ->
Model = list_to_atom(ModelName),
- [First|_] = Records = boss_db:find(Model, [], all, 0, id, str_descending),
+ [First|_] = Records = boss_db:find(Model, [], [descending]),
FirstLine = [lists:foldr(fun
(Attr, []) ->
[atom_to_list(Attr)];
Please sign in to comment.
Something went wrong with that request. Please try again.