     end
   end
 
-  def show(conn, %{"id" => _}) do
+  def show(conn, _) do
     article = conn.assigns[:article]
     render(conn, "show.json", article: article)
   end
 
-  def update(conn, %{"id" => id, "article" => article_params}) do
+  def update(conn, article_params) do
     article = conn.assigns[:article]
     changeset = Article.changeset(article, article_params)
 

    Repo.delete!(article)

    send_resp(conn, :no_content, "")
  end

  # Allow certain users to perform actions
  #
  # It is recommended to use this function as Plug
  defp authorize(conn, _opts) do
    user = Guardian.Plug.current_resource(conn)

    if Core.User.can?(user, "super_user") do
      conn
    else
      conn
      |> put_status(:forbidden)
      |> render(Core.ErrorView, "403.json", %{})
      |> halt()
    end
  end

  defp find(conn = %Plug.Conn{params: %{"id" => id}}, _opts) do


  alias Core.Article

  plug :find when action in [:update, :delete, :show]
  plug Core.Auth, %{key: :article,
                    type: "articles"} when action in [:create, :update, :delete]

  def index(conn, _params) do
    articles = Repo.all(Article)
    render(conn, "index.json", articles: articles)
  end

  def create(conn, article_params) do
    changeset = Article.changeset(%Article{}, article_params)

    case Repo.insert(changeset) do
