April 2016
Beginner to intermediate
300 pages
6h 58m
English
Rather than bog down in a digression on databases, data libraries, and related concerns, let’s agree to keep things simple in the beginning. We’ll start with a few hard-coded users. This strategy will help us in the long run too, because it’ll allow us to test our actions, views, and templates quickly, without needing to create a full database underneath.
Let’s define a Rumbl.User module with the fields id, name, username, and password:
| | defmodule Rumbl.User do |
| | defstruct [:id, :name, :username, :password] |
| | end |
The User module defines an Elixir struct, which is Elixir’s main abstraction for working with structured data.
Elixir structs ...