bilalhassankh
Hey, getting this error any solution?? I am using liveviews and livecomponent, trying to list projects that belong to same company in dropdown
<div>
<.form let={f} for={@changeset} phx-target={@myself} phx-change="validate" phx-submit={if @action == :edit_project, do: "update", else: "save"}>
<div class="form-control">
<p><%= gettext("Select Project") %></p>
<%=select f, :user_id, @project_users_options %>
<%= hidden_input f, :user_id%>
<%= error_tag f, :user_id %>
</div>
[error] GenServer #PID<0.14644.0> terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for %Appeo.Leads.Project{__meta__: #Ecto.Schema.Metadata<:loaded, "projects">, activities: #Ecto.Association.NotLoaded<association :activities is not loaded>, appointments: #Ecto.Association.NotLoaded<association :appointments is not loaded>, buildings: #Ecto.Association.NotLoaded<association :buildings is not loaded>, comments: #Ecto.Association.NotLoaded<association :comments is not loaded>, company: #Ecto.Association.NotLoaded<association :company is not loaded>, company_contact: #Ecto.Association.NotLoaded<association :company_contact is not loaded>, company_contact_id: 3, company_id: 4, contacts: #Ecto.Association.NotLoaded<association :contacts is not loaded>, description: "Mollit numquam non a", estimated_time: 78, id: 3, index: 1.0, inserted_at: ~N[2022-06-08 05:23:51], lead_column: #Ecto.Association.NotLoaded<association :lead_column is not loaded>, lead_column_id: 1, name: "Quamar Garcia", project_buildings: #Ecto.Association.NotLoaded<association :project_buildings is not loaded>, project_contacts: #Ecto.Association.NotLoaded<association :project_contacts is not loaded>, project_image: nil, project_materials: #Ecto.Association.NotLoaded<association :project_materials is not loaded>, project_permission_joined_users: #Ecto.Association.NotLoaded<association :project_permission_joined_users is not loaded>, project_stage: nil, project_start_date: ~U[1992-02-02 03:56:00Z], project_type: "any name", status: :active, tasks: #Ecto.Association.NotLoaded<association :tasks is not loaded>, updated_at: ~N[2022-06-08 05:23:51]} of type Appeo.Leads.Project (a struct)
(elixir 1.13.2) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.13.2) lib/enum.ex:143: Enumerable.reduce/3
(elixir 1.13.2) lib/enum.ex:4144: Enum.reduce/3
(phoenix_html 3.2.0) lib/phoenix_html/form.ex:1293: Phoenix.HTML.Form.option/4
(phoenix_html 3.2.0) lib/phoenix_html/form.ex:1268: anonymous fn/3 in Phoenix.HTML.Form.escaped_options_for_select/2
(elixir 1.13.2) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix_html 3.2.0) lib/phoenix_html/form.ex:1241: Phoenix.HTML.Form.options_for_select/2
(phoenix_html 3.2.0) lib/phoenix_html/form.ex:1184: Phoenix.HTML.Form.select/4
(appeo 0.1.0) lib/appeo_web/live/hr_live/dashboard/dashboard_project.html.heex:13: anonymous fn/3 in AppeoWeb.HRLive.DashboardProject.render/1
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:387: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:494: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
(elixir 1.13.2) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:387: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:494: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
(elixir 1.13.2) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:387: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:494: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
(elixir 1.13.2) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:387: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.17.7) lib/phoenix_live_view/diff.ex:664: Phoenix.LiveView.Diff.render_component/9
Last message: %Phoenix.Socket.Message{event: "event", join_ref: "4", payload: %{"event" => "new_project", "type" => "click", "value" => %{}}, ref: "6", topic: "lv:phx-FvaU2LDeNXvo515D"}
State: %{components: {%{1 => {AppeoWeb.LeftNavbar, "left_navbar", %{__changed__: %{}, flash: %{}, id: "left_navbar", myself: %Phoenix.LiveComponent.CID{cid: 1}}, %{__changed__: %{}, root_view: AppeoWeb.HRLive.Dashboard}, {122582042587124548347594463957129459263, %{}}}, 2 => {AppeoWeb.Header, "header", %{__changed__: %{}, current_user: #Appeo.Accounts.User<__meta__: #Ecto.Schema.Metadata<:loaded, "users">, company: %Appeo.Accounts.Company{__meta__: #Ecto.Schema.Metadata<:loaded, "companies">, buildings: #Ecto.Association.NotLoaded<association :buildings is not loaded>, company_contact: #Ecto.Association.NotLoaded<association :company_contact is not loaded>, company_currency: "USD", company_date_format: "MM/DD/YY", company_image: nil, company_language: "English", company_logo: nil, company_name: "invo", company_tenant_url: "invo", company_time_zone: "US/Eastern", contacts: #Ecto.Association.NotLoaded<association :contacts is not loaded>, id: 2, inserted_at: ~N[2022-06-01 07:33:00], updated_at: ~N[2022-06-01 07:33:00], users: #Ecto.Association.NotLoaded<association :users is not loaded>}, company_id: 2, company_name: nil, confirmed_at: nil, current_jwt: nil, email: "test@123.com", employee: #Ecto.Association.NotLoaded<association :employee is not loaded>, hashed_password: "$2b$12$6Rw2ZKjvWtBPGZQ8yX14uurQ5SjBYuzZCSBMZ8Z0kxFp./.r7WStO", id: 3, inserted_at: ~N[2022-06-07 09:29:25], microsoft_token: nil, name: nil, password_set: true, profile: %Appeo.Accounts.Profile{__meta__: #Ecto.Schema.Metadata<:loaded, "profiles">, date_format: "MM/DD/YY", id: 3, image: nil, inserted_at: ~N[2022-06-07 09:29:25], language: "en", name: "test123", phone_number: nil, position: nil, time_zone: "US/Eastern", updated_at: ~N[2022-06-07 09:29:25], user: #Ecto.Association.NotLoaded<association :user is not loaded>, user_id: 3}, provider: "identity", recieve_emails: nil, roles: [%Appeo.Accounts.Role{__meta__: #Ecto.Schema.Metadata<:loaded, "roles">, company: #Ecto.Association.NotLoaded<association :company is not loaded>, company_id: 3, description: "administrator", id: 3, inserted_at: ~N[2022-06-07 09:29:25], name: "Administrator", updated_at: ~N[2022-06-07 09:29:25], user_role: #Ecto.Association.NotLoaded<association :user_role is not loaded>, user_roles: #Ecto.Association.NotLoaded<association :user_roles is not loaded>, users: #Ecto.Association.NotLoaded<association :users is not loaded>}], updated_at: ~N[2022-06-07 09:29:25], user_roles: #Ecto.Association.NotLoaded<association :user_roles is not loaded>, ...>, flash: %{}, id: "header", myself: %Phoenix.LiveComponent.CID{cid: 2}}, %{__changed__: %{}, root_view: AppeoWeb.HRLive.Dashboard}, {5025354630627359592406180085880426220, %{2 => {194566674082730243471037961308665900275, %{}}}}}, 3 => {AppeoWeb.HRLive.DetailsComponent, :dashboard, %{__changed__: %{}, action: :dashboard, current_user: #Appeo.Accounts.User<__meta__: #Ecto.Schema.Metadata<:loaded, "users">, company: %Appeo.Accounts.Company{__meta__: #Ecto.Schema.Metadata<:loaded, "companies">, buildings: #Ecto.Association.NotLoaded<association :buildings is not loaded>, company_contact: #Ecto.Association.NotLoaded<association :company_contact is not loaded>, company_currency: "USD", company_date_format: "MM/DD/YY", company_image: nil, company_language: "English", company_logo: nil, company_name: "invo", company_tenant_url: "invo", company_time_zone: "US/Eastern", contacts: #Ecto.Association.NotLoaded<association :contacts is not loaded>, id: 2, inserted_at: ~N[2022-06-01 07:33:00], updated_at: ~N[2022-06-01 07:33:00], users: #Ecto.Association.NotLoaded<association :users is not loaded>}, company_id: 2, company_name: nil, confirmed_at: nil, current_jwt: nil, email: "test@123.com", employee: #Ecto.Association.NotLoaded<association :employee is not loaded>, hashed_password: "$2b$12$6Rw2ZKjvWtBPGZQ8yX14uurQ5SjBYuzZCSBMZ8Z0kxFp./.r7WStO", id: 3, inserted_at: ~N[2022-06-07 09:29:25], microsoft_token: nil, name: nil, password_set: true, profile: %Appeo.Accounts.Profile{__meta__: #Ecto.Schema.Metadata<:loaded, "profiles">, date_format: "MM/DD/YY", id: 3, image: nil, inserted_at: ~N[2022-06-07 09:29:25], language: "en", name: "test123", phone_number: nil, position: nil, time_zone: "US/Eastern", updated_at: ~N[2022-06-07 09:29:25], user: #Ecto.Association.NotLoaded<association :user is not loaded>, u (truncated)
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
You’re passing it a single project though, not a list.
bilalhassankh
This is how I am getting those project list
defp project_users_options(user_id, company_id) do
project_users = Leads.get_project_by_project_permission_joined_user(user_id, company_id)
end
def get_project_by_project_permission_joined_user(user_id, company_id) do
Repo.tenant_checkout(fn →
from(
project in Project,
join: pp in ProjectPermissionJoinedUser,
join: c in Company,
on: pp.project_id == project.id,
where: pp.user_id != ^user_id,
where: c.id == ^company_id
)
|> Repo.all()
end)
end
bilalhassankh
This is my update call in livecomponent
def update(
%{
project: project,
action: action
} = assigns,
socket
) do
socket =
socket
|> assign(assigns)
end