start new:
tmux
start new with session name:
tmux new -s myname
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
defmodule MyApp.Auth do | |
import Comeonin.Bcrypt, only: [checkpw: 2, dummy_checkpw: 0] | |
alias MyApp.Accounts.User | |
alias MyApp.Repo | |
def login(conn, user) do | |
conn | |
|> Guardian.Plug.sign_in(user) | |
end |
I recently wanted to rename a model and its postgres table in a Phoenix app. Renaming the table was simple and documented, but the table also had constraints, sequences, and indexes that needed to be updated in order for the Ecto model to be able to rely on default naming conventions. I couldn't find any examples of what this would look like but was eventually able to figure it out. For anyone else in the same situation, hopefully this example helps.
In the example below, I'm renaming the Permission
model to Membership
. This model belongs to a User
and an Account
, so it has foreign key constraints that need to be renamed.
defmodule MyApp.Repo.Migrations.RenamePermissionsToMemberships do
use Ecto.Migration
I'm a member of the Erlang Ecosystem Foundation (https://erlef.org/) and part of that in my opinion is making sure folks know how to reach Elixir devs when they need to. I'm very interested in helping you showcase that your company is hiring so heavily for Elixir. Since you were kind in our email exchange, I'll return the kindness and hopefully help you find as many Elixir devs you can hire :). Just promise me to keep creating more Elixir jobs : ) :
Here are some interesting ways to find Elixir devs:
jobs
category, so you should get interest there as well.defmodule NestedWeb.FormLive do | |
use NestedWeb, :live_view | |
require Logger | |
defmodule Form do | |
use Ecto.Schema | |
import Ecto.Changeset | |
embedded_schema do | |
field :name, :string |