Unique_constraint issue

I am trying to add unique_contrain to my projects, and it is working beautifully with one of my tables that has only one field, but i with the other one it is not working.
I want to show to the user that a name is already taken on creation or at edit, but it keeps giving me an error that assign @teams not available in eex template.

but I think that the unique_constarint should kick in before this, that it should not get to the point that it redirects, so why is this happening?

the code: https://github.com/benonymus/userteamroleapi

This means that the render call for that template did not include a teams: ... argument. What is the exact url to that render call?

I’m guessing the error is happening at?

If so then two render calls are missing teams: ..., one at:

And the other at:

In addition to those, he should also reference @teams on both new and edit templates (that calls form).

Something like this.

    render "form.html",
    teams: @teams,
1 Like