protocol Ecto.Queryable not implemented for
<p>I'm trying to implement Guardian into my API and perform a login through it to get JWT back. The tutorial I'm looking at is <a href="http://hassox.github.io/elixir/guardian/2015/06/29/simple-email-password-authentication.html" rel="noreferrer">here</a>. The problem is implementing the login using a User Model similar to what they're using in the example. The Model code looks like:</p>

<pre><code>defmodule PushflightServer.User do
  use PushflightServer.Web, :model

use Ecto.Repo
import Ecto.Query
  alias PushflightServer.Repo

  schema "users" do
    field :name, :string
    field :email, :string
    field :encrypted_password, :string
    field :password, :string, virtual: true
    field :verify_token, :string
    field :verify_date, Ecto.DateTime

    timestamps
  end

  def from_email(nil), do: { :error, :not_found }
  def from_email(email) do
    IO.write("Before email")
    IO.inspect(email)
    Repo.one(User, email: email)
  end
</code></pre>

<p>If I call the from_email either from within Phoenix or straight in <strong>iex -S mix</strong>, I get the following error:</p>

<p><em>user = PushflightServer.User.from_email("rob@json.com")</em></p>

<blockquote>
  <p>** (Protocol.UndefinedError) protocol Ecto.Queryable not implemented for User, the given module does not exist
      (ecto) lib/ecto/queryable.ex:33: Ecto.Queryable.Atom.to_query/1
      (ecto) lib/ecto/repo/queryable.ex:90: Ecto.Repo.Queryable.execute/5
      (ecto) lib/ecto/repo/queryable.ex:15: Ecto.Repo.Queryable.all/4
      (ecto) lib/ecto/repo/queryable.ex:44: Ecto.Repo.Queryable.one/4</p>
</blockquote>

<p>I must be missing something simple, but I haven't been able to find any documentation about why this is happening. The insert of the data using the Repo worked fine. Any ideas?</p>