(FunctionClauseError) no function clause matching in Ecto.Changeset.cast/4

2,221 views
Skip to first unread message

r/ Wobben

unread,
Jul 16, 2015, 8:56:58 AM7/16/15
to phoeni...@googlegroups.com
Hello,

I still try to make a authentication in my app.
Everything seems to be goig well till I visit my /registration  page.

Then I see this error message:



which I wierd because I did not get the ability to fill in the registration form.

Anyone a idea what went wrong here ?

Roelof

(FunctionClauseError) no function clause matching in Ecto.Changeset.cast/4

r/ Wobben

unread,
Jul 16, 2015, 8:59:20 AM7/16/15
to phoeni...@googlegroups.com
The whole eror message is :


error] #PID<0.283.0> running PhoenixAccounting.Endpoint terminated
Server: phoenix-accounting-112787.nitrousapp.com:4000 (http)
Request: GET /registration
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Ecto.Changeset.cast/4
        (ecto) lib/ecto/changeset.ex:186: Ecto.Changeset.cast(%PhoenixAccounting.User{__meta__: %Ecto.Schema.Metadata{source: "users", state: :built}, encrypted_password: nil, id: nil, inserted_at: nil, password: nil, password_confirmation: nil,



and you can find the code here :  https://github.com/rwobben/phoenix-accounting

Op donderdag 16 juli 2015 14:56:58 UTC+2 schreef r/ Wobben:

Kofi Boakye

unread,
Jul 16, 2015, 1:39:20 PM7/16/15
to phoeni...@googlegroups.com
Hi

I believe the issue is that in ecto 0.13 an empty params must given with the :empty atom.

This is seen from the ecto docs    as shown below..
......

Empty parameters

The params argument can also be the atom :empty. In such cases, the changeset is automatically marked as invalid, with an empty :changes map. This is useful to run the changeset through all validation steps for introspection.

.................


try def changeset(model, params \\ :empty)  instead of def changeset(model, params \\ nil) and lets see if it works .





r/ Wobben

unread,
Jul 17, 2015, 4:43:02 AM7/17/15
to phoeni...@googlegroups.com

Thanks, that did the trick.

Roelof

Op donderdag 16 juli 2015 19:39:20 UTC+2 schreef Kofi Boakye:
Reply all
Reply to author
Forward
0 new messages