Phoenix: only IEx is required: dev and: test for the whole project

I am new to Elixir / Phoenix and I was wondering if there is a way to require IEx essentially require IEx in the same way as in Ruby / Rails you can add something like

 group :test, :development do gem 'pry', require: 'pry' end 

which will allow you binding.pry essentially in any file without having to include require 'pry'

I find that I need require IEx on any controller, model, view, etc. I want to debug to be tedious.

+5
source share
1 answer

You can use the web/web.ex file.

A module that uses definitions for controllers, views, and so on.

This can be used in your application as:

 use App.Web, :controller use App.Web, :view 

The definitions below will be performed for each view, controller, etc., so keep them short and clean, focused on import, use and aliases.

Just put require IEx here when you need it for controllers, models, etc.

 defmodule App.Web do def model do quote do ... require IEx end end def controller do quote do ... require IEx end end end 
0
source

Source: https://habr.com/ru/post/1262442/


All Articles