Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is a misplaced `}` :) He actually wanted to do :

        def handle_event(save, params, socket) do
      ...
      {:noreply,
      socket
      |> put_flash(:info, "It worked!"
      |> redirect(to: "..."))}
    end
which would work.


Ah. It's a nonstandard formatting though.


Agree-- Even if it's possible I always feel dirty to do that kind of "magic", and always prefer this way:

    def handle_event(save, params, socket) do
      socket = socket
      |> put_flash(:info, "It worked!")
      |> redirect(to: "...")
      {:noreply, socket}
    end
I feel like it's more readable this way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: