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’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
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
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
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
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











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