Is there a Phoenix equivalent to Rails Console

phoenix ecto
phoenix quickstart
elixir phoenix pry
phoenix create database
phoenix application
phoenix hello world
elixir run server
iex pry not working

I'm just learning Phoenix and Elixir and I'm coming from Ruby/Rails where I work in the REPL using pry to inspect my database and application state.

I'm trying to figure out how to interact with my database and models in a Phoenix app. I'm aware of iex, but I don't know how to use it inspect my app's database from the repl. Do I need to connect to it with ecto each time from the repl? Is there a rails console equivalent. I've checked the Phoenix docs, Elixir Dose, and the Ecto repo, but can't find what I'm looking for. Am I missing something?

Edit: Based on the answer below I found this section of the ecto docs. Based on this I can do something like ArticlesApi.Repo.all ArticlesApi.Article

You can run iex -S mix to run iex with the dependencies in your current mix project included.. You can read about this at http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html

From there you can execute Ecto queries:

iex> MyApp.Repo.all(MyApp.User)

Running iex -S mix phoenix.server will also start the phoenix server.

Is there a Phoenix equivalent to Rails Console - elixir - html, Do I need to connect to it with ecto each time from the repl? Is there a rails console equivalent. I've checked the Phoenix docs, Elixir Dose, and the Ecto repo​, but  I'm trying to figure out how to interact with my database and models in a Phoenix app. I'm aware of iex, but I don't know how to use it inspect my app's database from the repl. Do I need to connect to it with ecto each time from the repl? Is there a rails console equivalent. I've checked the Phoenix docs, Elixir Dose, and the Ecto repo, but can

For runtime debug, (like byebug or debugger or pry in rails), use

require IEx at the top of your model or controller or views file, then type

IEx.pry to wherever you need it to halt at runtime and continue debugging.

Type h for help inside the console

Most importantly, after all that, restart your server with:

iex -S mix phoenix.server

More info: here

Phoenix equivalent of rails console sandbox, What's elixir/phoenix equivalent of below? rails console —sandbox There are some caveats to this though, since the sandbox works by  Phoenix and Rails equivalent commands Oct 21, 2016 #Elixir/Phoenix #Ruby on Rails. Recently, I started trying with Elixir/Phoenix. There are many similar things between Ruby/Rails and Phoenix/Elixir. Here I started with some commands.

If you're working in development, use iex -S mix phx.server.

If you need into the console of a deployed release, then go to your release directory and run bin/<name of your app> remote_console to open up a remote shell to your app's console.

Getting Started with Phoenix (as a Rails Developer), Do I need to connect to it with ecto each time from the repl? Is there a rails console equivalent. I've checked the Phoenix docs, Elixir Dose, and  117 Is there a Phoenix equivalent to Rails Console Oct 26 '15. 111 How to check if an item exists in an Elixir list or tuple? Apr 5 '16.

Phoenix and Rails equivalent commands · Quyet Bui, Comparing testing and development tools for Elixir-Phoenix and The most comparable tests you'll find in a Rails app are helper specs. Working in the Rails console is a bit different than working in a Phoenix console, but  Setting up Phoenix Framework and Ecto to use UUIDs: how to insert the generated value? Is there a Phoenix equivalent to Rails Console ; Is Phoenix's scrub_params like Rails strong parameters? How to get the “belongs_to” association with Ecto in Elixir?

Rewriting a Ruby/Rails app in Elixir/Phoenix (Almost) Literally : ruby, Phoenix and Rails equivalent commands There are many similar things between Ruby/Rails and iex -S mix phoenix.server, rails console. query queries multiple group complex assoc elixir phoenix-framework ecto Mixing Scopes and Associations in Phoenix/Ecto Is there a Phoenix equivalent to Rails Console

How fast is Elixir Phoenix than Rails? - StackAvenue, Rewriting a Ruby/Rails app in Elixir/Phoenix (Almost) Literally What would you recommend as an alternative? Continue this thread. View entire More posts from the ruby community. 264 Testing migrations from sandboxed Rails console. I'm trying to figure out how to interact with my database and models in a Phoenix app. I'm aware of iex, but I don't know how to use it inspect my app's database from the repl. Do I need to connect to it with ecto each time from the repl? Is there a rails console equivalent. I've checked the Phoenix docs, Elixir Dose, and the Ecto repo, but can

Comments
  • You can save some typing by aliasing the module names: alias ArticlesApi.{Repo, Article}. Also, keep in mind that you can very conveniently recompile individual modules from your console (r Article), or recompile the whole project using recompile. This allows you to leave an iex session open all the time, keeping aliases active.
  • It's also worth noting the convenience of an iex.exs file in the root of your project to allow you to setup aliases (so you don't have to precede everything with MyApp.). An example would be: alias MyApp.Repo alias MyApp.User alias MyApp.Car
  • Is there a way I can use this in production environment?
  • @Chris.Zou Yes, use bin/my_app remote_console in your remote shell.
  • This is actually iex -S mix phx.server since Phoenix 1.3.