Phoenix v1.3.0-rc.0 released


Oh, right. The context file is nested in the post. I was looking at the screenshot.


Hm, should this work?

$ mix phx.gen.schema Blog.User blog_users name > /dev/null                                                                                                                                                                            
$ mix ecto.migrate > /dev/null                                                                                                                                                                                                        
$ mix phx.gen.schema Blog.Post blog_posts title user_id:references:users                                                                                                                                                              
** (Mix) Unknown type `users` given to generator                                                                                                                                                                                      
$ mix phx.gen.schema Blog.Post blog_posts title user_id:references:blog_users                                                                                                                                                         
** (Mix) Unknown type `blog_users` given to generator


Hi, I can’t get deps after mix MyApp. Anyone can help?

$ mix deps.get
Running dependency resolution...

Failed to use "phoenix" because
  mix.exs specifies ~> 1.3.0-rc

** (Mix) Hex dependency resolution failed, relax the version requirements of your dependencies or unlock them (by using mix deps.update or mix deps.unlock). If you are unable to resolve the conflicts you can try overriding with {:dependency, "~> 1.0", override: true}


Have you tried the suggested solutions?


Yes, I tried. But had same error report.


We have decided to nest them after the talk was given. So the post is correct, the talk is slightly out of date.


Can you please run mix and let us know what it returns? Can you also include your mix.exs file?


Yes, it was supposed to work. Can you please do a bug report on the issues tracker? Thank you!

$ mix
Hex:    0.15.0
Elixir: 1.4.0
OTP:    19.1

Built with: Elixir 1.3.4 and OTP

I did’t change mix.exs file after running mix three.

defmodule Three.Mixfile do
  use Mix.Project

  def project do
    [app: :three,
     version: "0.0.1",
     elixir: "~> 1.4",
     elixirc_paths: elixirc_paths(Mix.env),
     compilers: [:phoenix, :gettext] ++ Mix.compilers,
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     aliases: aliases(),
     deps: deps()]

  # Configuration for the OTP application.
  # Type `mix help` for more information.
  def application do
    [mod: {Three.Application, []},
     extra_applications: [:logger]]

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_),     do: ["lib"]

  # Specifies your project dependencies.
  # Type `mix help deps` for examples and options.
  defp deps do
    [{:phoenix, "~> 1.3.0-rc"},
     {:phoenix_pubsub, "~> 1.0"},
     {:phoenix_ecto, "~> 3.2"},
     {:postgrex, ">= 0.0.0"},
     {:phoenix_html, "~> 2.6"},
     {:phoenix_live_reload, "~> 1.0", only: :dev},
     {:gettext, "~> 0.11"},
     {:cowboy, "~> 1.0"}]

  # Aliases are shortcuts or tasks specific to the current project.
  # For example, to create, migrate and run the seeds file at once:
  #     $ mix ecto.setup
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    ["ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
     "ecto.reset": ["ecto.drop", "ecto.setup"],
     "test": ["ecto.create --quiet", "ecto.migrate", "test"]]


Congratulations to Chris, the @Phoenix-Core-Team and everyone who has worked on it - awesome release :023:

I’m pleased to see this, looks much better Imo :slight_smile:


Thanks for information!


Try this. Create a new project with mix new hello and then change the mix.exs file to do the following:

defp deps do
   [{:phoenix, "~> 1.3.0-rc"},]

Can Hex fetch Phoenix? If it cannot, it is an issue with your Hex installation. Or it cannot find Phoenix or it cannot update the registry metadata. If so, try deleting any *.ets or *.ets.gz files in ~/.hex.


What was the motivation behind changing directory structure? The one with main modules nested in lib and other modules in the same named folders seemed really reasonable - it was quite natural split between high level API and implementation details. It is also convention used in every library in the language and I believe would make it easier to eventually split app into separate OTP apps as needed.

Besides that - great direction! I really like how Phoenix emphasizes its use case and does not want to be all-in package - it always bothered me with Rails.


Thank you!
It seems to be caused by the hex mirror. After removing mirror_url in hex.config, everything goes well.


Thanks @chrismccord for this! It’s awesome. When I digged into Phoenix few months ago I saw it uses some parts of DDD eg. isolated repo to orchestrate the models, but now it’s all right. Bounded Contexts are another needed level of abstraction, so controller doesn’t look like “I’m the boss and I force repo to do anything for me”, but he deals with BCs. Also changing the structure is very nice.

Does the live reload now apply for /lib/myapp/web/*? I guess it is. Also I like generators using phx and your effort that we should think more about the code and how we gonna use it and less about generating CRUDs and wondering how to modify them :slight_smile:


To clarify - ecto repo is not a repository pattern. It differs in some key areas, most notably repository pattern calls for a repo per entity you’re going to query - ecto has just one repo that is used to explicitly represent the database in the code - one for all entities.

Neither phoenix’s contexts are bounded contexts per DDD on their own - you can use them as such, but there’s nothing that requires it. I’m sure it was an inspiration, but I’m also pretty sure the phoenix team does not want to enforce DDD on everybody.


Yeah, but I don’t follow DDD as it is. I just like that’s what’s most important and usable is in Phoenix as it should be. Using BCs is concise, clear and will make controllers way more thin :slight_smile:

Also action_fallback is great here and using with clause.


I too am used to the convention where my_context.ex and my_context/ are in the same directory. The module names MyContext and MyContext.MySchema are also consistent with the former structure.


Is there anyway to prevent ecto? Earlier was --no-ecto.



yes, same flag, mix my_app --no-ecto