hamiltop / rethinkdb_ecto

Shim library for using Ecto with RethinkDB. Not a full adapter.
24 stars 4 forks source link

Bug when not using generated keys #12

Open ganjo opened 8 years ago

ganjo commented 8 years ago

Hi I got a problem when I make an insertion using my own primary key (for uniqueness), this throw an exception for example inserting: %{"field1": "barfoo", "filed2": "foobar"} -> Ok

but

%{"id": "myownid", "field1": "barfoo", "field2": "foobar"} -> ** (exit) an exception was raised: ** (CaseClauseError) no case clause matching: %RethinkDB.Record{data: %{"deleted" => 0, "errors" => 0, "inserted" => 1, "replaced" => 0, "skipped" => 0, "unchanged" => 0}, profile: nil}

Any idea ? thx

hamiltop commented 8 years ago

Do you have the full stack trace? A line number would be great.

ganjo commented 8 years ago

sure: Request: POST /users * (exit) an exception was raised: * (CaseClauseError) no case clause matching: %RethinkDB.Record{data: %{"deleted" => 0, "errors" => 0, "inserted" => 1, "replaced" => 0, "skipped" => 0, "unchanged" => 0}, profile: nil} lib/rethinkdb_ecto/connection.ex:65: RethinkDB.Ecto.Connection.do_insert/2 (testguide) web/controllers/user_controller.ex:17: Testguide.UserController.create/2 (testguide) web/controllers/user_controller.ex:1: Testguide.UserController.action/2 (testguide) web/controllers/user_controller.ex:1: Testguide.UserController.phoenix_controller_pipeline/2 (testguide) lib/phoenix/router.ex:261: Testguide.Router.dispatch/2 (testguide) web/router.ex:1: Testguide.Router.do_call/2 (testguide) lib/testguide/endpoint.ex:1: Testguide.Endpoint.phoenix_pipeline/1 (testguide) lib/plug/debugger.ex:93: Testguide.Endpoint."call (overridable 3)"/2 (testguide) lib/phoenix/endpoint/render_errors.ex:34: Testguide.Endpoint.call/2 (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4 (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4