lc0815
Hello one and all, I am trying to create a full stack app with react and phoenix from an article that uses phoenix 1.3 while I’m using the latest version 1.5.7. in the article, the models db access is used and version 1.5.7 no longer uses the models so my app gives me the following error when I send a get request from postman0
function Repo.all/1 is undefined (module Repo is not available)
The controller file
defmodule PhxReactList7Web.BlogsController do
use PhxReactList7Web, :controller
alias PhxReactList7.Blogs
def index(conn, _params) do
blogs = Repo.all(Blogs)
render conn, "index.json", blogs: blogs
end
end
the repo file
defmodule PhxReactList7.Repo do
use Ecto.Repo,
otp_app: :phx_react_list_7,
adapter: Ecto.Adapters.Postgres
end
the blogs file
defmodule PhxReactList7.Blogs do
import Ecto.Query, warn: false
end
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
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
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
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 new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
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
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
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kip
In the docs,
Repo.fun/arityneeds to be considered asMyApp.Repo.fun. So in your example, I would suggest addingalias PhxReactList7.Repoin your controller and you should be good to go.lc0815
thank you for your answer, will add it now…
lc0815
the new controller file now looks like this:
and now I get the error:
I guess my main problem is that I am totally confused where the schema and the database tables are defined and used inside the application as the steps described in the article do now correspond to the current version.
I have read both the controllers guides and the ecto guides but I still have not made the connection between the dots metaphorically.
I did the migration step and that worked, I then added a few records to the database so I’m good there.
ityonemo
Database tables are defined in the migrations. You didn’t create a schema in your .Blogs module
Ecto treats schemas separately from the database and does not autopopulate it for you. You can have more than one schema for any given database table, you can use that to enforce contextual boundaries on database columns access (context A needs to only see these columns and context B needs to only see these other columns)
lc0815
I did create a schema, the file name is blogs.ex under the blogs directory under the app directory
the file looks like this:
I followed the Ecto guides in creating the schema file, but I may have the object names wrong…
anywho: thank you for your great response…
kokolegorille
That’s the inconvenient following 1.3 tuto, there were no context and no schema, but models…
Also beware of Blog, Blogs, blog, blogs. Because You made some mistakes in the naming.
What You should have is something like PhxReactList7.Blogs.Blog with Blogs being the context, and blog being the schema.
I suggest You start a demo project and initialize a simple resource, and see how it is done with 1.5
With mix phx.gen.context
lc0815
I figured as much. I did just as are suggesting and created the friends mix app as shown in the Ecto guides but that demo does not go far enough as it does not have a front end section to the example that uses the created schema/tables context
I will start all over again by reading about context and other things and also I will put the project in github so I don’t have to cut and paste like I’m doing now..
the Blogs, Blogs.blog, blogs and other bloggie issues did not work for me… again because of the 1.3 to 1.5 incompatibility issue and there does not seem to be any docs that amplify or describe the way to go from one to the other…
Thanks
kokolegorille
Google is your friend
https://medium.com/adorableio/from-models-to-contexts-in-phoenix-1-3-0-1535d1d773b2
lc0815
Oh boy have I been into google, but sometimes friends do not understand what you are trying to ask or the questions do not make any sense to your friend, so the answers do not help.
No prob, will continue to google, and to bing it with edge as well.
Thanks again, will read the medium article since I also am a subscriber…
ityonemo
just to be clear, you need to pass the PhxReactList7.Blog module to the repo function. Currently you are passing the PhxReactList7.Blogs module to the repo function.