     render conn, "new.html", changeset: changeset
   end
 
-  def create(conn, params) do
-    changeset = Post.changeset %Post{}, params["post"]
+  def create(conn, %{ "post" => post_params }) do
+    changeset = Post.changeset %Post{}, post_params
     if changeset.valid? do
       post = Repo.insert(changeset)
       conn

    end
  end

  def delete(conn, params) do
    Post.destroy params["id"]
    conn
      |> put_flash(:notice, "Post deleted!")
      |> redirect to: posts_path(conn, :index)

    end
  end

  def edit(conn, %{ "id" => id }) do
    post = Post |> Repo.get!(id) |> Post.changeset
    render conn, "edit.html", changeset: post
  end

  def update(conn, %{ "id" => id, "post" => post_params }) do
    changeset = Post |> Repo.get!(id) |> Post.changeset(post_params)
    if changeset.valid? do
      post = Repo.update(changeset)
      conn
