0
Noob 외계인이 양식을 작성하려고합니다 belongs_to
관계. available assigns
에 users
변수를 추가하려면 어떻게해야합니까?ecto 사용자가 belongs_to association을 선택하십시오
컨트롤러 :
def new(conn, params) do
changeset = Project.changeset(%Project{})
users = Repo.all(from(u in User, order_by: u.email, select: {u.email, u.id}))
Logger.debug "Controller: #{inspect users}"
render(conn, "new.html", changeset: changeset, users: users)
end
형태 :
<%= form_for @changeset, @action, @users, fn f -> %>
<div class="form-group">
<%= label f, :user_id, class: "control-label" %>
<%= Logger.debug "View 2: #{inspect @users}" %>
<%= select f, :user_id, @users, class: "form-control" %>
<%= error_tag f, :user_id %>
</div>
오류 메시지 :
(ArgumentError) assign @users not available in eex template.
Available assigns: [:action, :changeset]
잘 큰, 나는이 (가) available assigns
에 사용자를 추가하기 위해 노력하고있어.