I have a user schema. From which I have to fetch showing certain fields. So I have two controllers and both are fetching the data from same model.
So here is my profiles_view j
defmodule AppWeb.ProfilesView do
use AppWeb, :view
alias AppWeb.ProfilesView
def render(action, params) do
IO.inspect action
IO.inspect params
end
def render("profiles.json", %{profiles: profiles}) do
%{data: render_many(profiles, ProfilesView, "profile.json")}
end
def render("profile.json", result) do
end
end
But here Iām getting data in my profiles. So I did inspect action and params. So in action Iām getting āprofiles.jsonā and
in params assigns
%{
layout: false,
profiles: %App.Auth.User{
__meta__: #Ecto.Schema.Metadata<:loaded, "itlabs", "user">,
avatar: nil,
background: nil,
created_date: ~N[2020-04-20 18:58:24],
email: "sidd3009@gmail.com",
}
But when I call after first render function Iām getting this kind of error
** (exit) an exception was raised:
** (Protocol.UndefinedError) protocol Enumerable not implemented
This error related to the data Iām receiving. But I want to know why the layout is false?
Please check assigns