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
Hi all,
I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
I’m very new to Elixir, so sorry if this is a silly question:
I am wondering what happens to the mailbox of a process when the machine i...
New
How do I tell Hologram not to escape HTML when substituting into templates?
{Textile.render(@product.long_description)}
escapes the HTM...
New
Background
When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error:
* assembling mark...
New
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New
When I use Mix.install with a git dependency, using git@github.com:... how do I change the SSH identity used?
I’ve got two Github accoun...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hi everyone :waving_hand:
I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
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
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
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
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #elixirconf-us
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #elixirconf-eu
- #processes
- #security
- #api
- #forms
- #performance











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