{"_id":"559221e01da5250d001e969b","initVersion":{"_id":"559218ac1da5250d001e966f","version":"0.14.0"},"tags":[],"project":"54348ec95b10711400c6c445","user":{"_id":"5435b410495d5d0800f3a603","username":"","name":"Lance Halvorsen"},"__v":0,"createdAt":"2015-06-30T04:58:08.428Z","changelog":[],"body":"First, bump your phoenix in `mix.exs`:\n\n    def deps do\n      [{:phoenix, \"~> 0.14\"}, ...\n    end\n\n## `phoenix_html`\n\nUpdate your `phoenix_html` version to `1.1.0` in `mix.exs`:\n\n    def deps do\n      [{:phoenix, \"~> 0.14\"},\n      {:phoenix_html, \"~> 1.1\"}, ...\n    end\n\nthen run `$ mix deps.get`\n\n1.1 raises on missing assigns in your templates. If you had cases where you were using assigns that may or may not have been set, update your code as so:\n\n0.13.x\n\n```erb\n<%= if @message do %>\n```\n\n0.14.0\n\n```erb\n<%= if assigns[:message] do %>\n```\n\n## Controller\n\n`plug :action` is now called automatically as the last plug in your controller. Simply remove it, ie:\n\n0.13.x:\n\n```elixir\ndefmodule App.Controller do\n  use App.Web, :controller\n  \n  plug :authenticate\n  plug :action\n  \n  def show(conn, params) do\n    ...\n  end\nend\n```\n\n0.14.0:\n\n```elixir\ndefmodule App.Controller do\n  use App.Web, :controller\n  \n  plug :authenticate\n  \n  def show(conn, params) do\n    ...\n  end\nend\n```\n\n## View\nThe default template `web/templates/layout/application.html.eex` has been renamed to `app.html.eex`. Simply rename this file:\n\n    $ mv web/templates/layout/application.html.eex web/templates/layout/app.html.eex\n\n## Endpoint\nThe `:format` option in `:render_errors` has been renamed to `:default_format`. Update your `config/*.exs` accordingly.\n\n## Phoenix.PubSub.Redis\nThe Redis PubSub adapter has been extracted into its own project. If using redis, see the project's readme for [installation and configuration instructions](https://github.com/phoenixframework/phoenix_pubsub_redis)\n\n## Javascript client\n\nUpgarde to the latest phoenix.js client by replacing `web/static/js/vendor/phoenix.js` with the latest version: https://raw.githubusercontent.com/phoenixframework/phoenix/6da5a66a11ff02e5629e3512649413afe9257bc7/priv/static/phoenix.js\n\nSocket params can now be added to apply default, overridable params to all channel params, ie\n\n```javascript\nlet socket = new Phoenix.Socket(\"/ws\", {params: {userToken: theToken}})\n```\n\nLogging has been enhanced. To enable logging, or add customized logging of events, add a callback to the socket options, ie:\n\n```javascript\nlet socket = new Phoenix.Socket(\"/ws\", {\n  logger: (kind, msg, data) => { console.log(${kind}: ${msg}, data) }\n})\n```\n\n## Troubleshooting\n\nAn error like this:\n\n```console\nLooking up alternatives for conflicting requirements on phoenix\nActivated version: 0.14.0\nFrom phoenix_live_reload v0.4.0: ~> 0.13.0\nFrom mix.exs: ~> 0.14\n** (Mix) Hex dependency resolution failed, relax the version requirements or unlock dependencies\n```\n\nindicates that the `phoenix_live_reload` version is incorrect. The fix is to bump the version in `deps/0` in `mix.exs` to `0.4.3`.\n\n```elixir\ndefp deps do\n    [{:phoenix, \"~> 0.13.1\"},\n     {:phoenix_ecto, \"~> 0.4\"},\n     {:postgrex, \">= 0.0.0\"},\n     {:phoenix_html, \"~> 1.0\"},\n     {:phoenix_live_reload, \"~> 0.4.3\", only: :dev},    # <- Bump version here\n     {:cowboy, \"~> 1.0\"},\n     {:exrm, \"~> 0.15.3\"}]\n  end\n```","slug":"upgrading-from-v013x-to-v0140","title":"Upgrading from v0.13.x to v0.14.0"}

Upgrading from v0.13.x to v0.14.0


First, bump your phoenix in `mix.exs`: def deps do [{:phoenix, "~> 0.14"}, ... end ## `phoenix_html` Update your `phoenix_html` version to `1.1.0` in `mix.exs`: def deps do [{:phoenix, "~> 0.14"}, {:phoenix_html, "~> 1.1"}, ... end then run `$ mix deps.get` 1.1 raises on missing assigns in your templates. If you had cases where you were using assigns that may or may not have been set, update your code as so: 0.13.x ```erb <%= if @message do %> ``` 0.14.0 ```erb <%= if assigns[:message] do %> ``` ## Controller `plug :action` is now called automatically as the last plug in your controller. Simply remove it, ie: 0.13.x: ```elixir defmodule App.Controller do use App.Web, :controller plug :authenticate plug :action def show(conn, params) do ... end end ``` 0.14.0: ```elixir defmodule App.Controller do use App.Web, :controller plug :authenticate def show(conn, params) do ... end end ``` ## View The default template `web/templates/layout/application.html.eex` has been renamed to `app.html.eex`. Simply rename this file: $ mv web/templates/layout/application.html.eex web/templates/layout/app.html.eex ## Endpoint The `:format` option in `:render_errors` has been renamed to `:default_format`. Update your `config/*.exs` accordingly. ## Phoenix.PubSub.Redis The Redis PubSub adapter has been extracted into its own project. If using redis, see the project's readme for [installation and configuration instructions](https://github.com/phoenixframework/phoenix_pubsub_redis) ## Javascript client Upgarde to the latest phoenix.js client by replacing `web/static/js/vendor/phoenix.js` with the latest version: https://raw.githubusercontent.com/phoenixframework/phoenix/6da5a66a11ff02e5629e3512649413afe9257bc7/priv/static/phoenix.js Socket params can now be added to apply default, overridable params to all channel params, ie ```javascript let socket = new Phoenix.Socket("/ws", {params: {userToken: theToken}}) ``` Logging has been enhanced. To enable logging, or add customized logging of events, add a callback to the socket options, ie: ```javascript let socket = new Phoenix.Socket("/ws", { logger: (kind, msg, data) => { console.log(${kind}: ${msg}, data) } }) ``` ## Troubleshooting An error like this: ```console Looking up alternatives for conflicting requirements on phoenix Activated version: 0.14.0 From phoenix_live_reload v0.4.0: ~> 0.13.0 From mix.exs: ~> 0.14 ** (Mix) Hex dependency resolution failed, relax the version requirements or unlock dependencies ``` indicates that the `phoenix_live_reload` version is incorrect. The fix is to bump the version in `deps/0` in `mix.exs` to `0.4.3`. ```elixir defp deps do [{:phoenix, "~> 0.13.1"}, {:phoenix_ecto, "~> 0.4"}, {:postgrex, ">= 0.0.0"}, {:phoenix_html, "~> 1.0"}, {:phoenix_live_reload, "~> 0.4.3", only: :dev}, # <- Bump version here {:cowboy, "~> 1.0"}, {:exrm, "~> 0.15.3"}] end ```