What is a changeset in phoenix elixir

From the documentation: Changesets allow filtering, casting, validation and definition of constraints when manipulating models.. There is an example of working with changesets in the introductory documentation in the Ecto module. The functions change/2 and cast/4 are the usual entry points for creating changesets, while the remaining functions are useful for manipulating them. Changesets are … Read more

What is Elixir Plug?

Is it an abstraction layer between the two Yes, exactly! Plug is meant to be a generic adapter for different web servers. Currently we support just Cowboy but there is work to support others. Plug also defines how different components should be plugged together. Similar to Rack in Ruby, WSGI in Python, Ring in Clojure, … Read more

How can I make Elixir mix test output more verbose?

To print the names of the passing tests, you can pass –trace argument to mix test. For example, here’s the output of mix test –trace on the current master branch of httpoison package: $ mix test –trace HTTPoisonTest Starting HTTParrot on port 8080 Starting HTTParrot on port 8433 (SSL) Starting HTTParrot on unix socket httparrot.sock … Read more

How to generate a random url safe string with Elixir

What you can do instead is to generate a Base64-encoded string to be used as a confirmation token. This confirmation token will then be saved to your DB and passed as params to the activation link. Your activation url would look something like: activation_url(MyApp.Endpoint, :confirm, confirm_id: confirm_id) The above url helper assumes you have a … Read more

How to rollback, reset, or drop Ecto test database?

You can access the test database by using MIX_ENV=test followed by a command such as mix do ecto.drop, mix ecto.reset or mix ecto.rollback. In this particular case, I used: MIX_ENV=test mix ecto.reset If your application has multiple repos (DBs), you’ll want to specify a specific repo to avoid applying the operation to all repos. For … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)