benonymus
Unique_constraint issue
Hey,
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?
Marked As Solved
OvermindDL1
I’m guessing the error is happening at?
https://github.com/benonymus/userteamroleapi/blob/master/lib/userteam1_web/templates/user/form.html.eex#L22
If so then two render calls are missing teams: ..., one at:
https://github.com/benonymus/userteamroleapi/blob/master/lib/userteam1_web/controllers/user_controller.ex#L43
And the other at:
https://github.com/benonymus/userteamroleapi/blob/master/lib/userteam1_web/controllers/user_controller.ex#L80
Also Liked
pedromvieira
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,
...
%>
Last Post!
pedromvieira
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,
...
%>
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









