{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/463","labels_url":"https://api.github.com/repos/elixir-lang/ecto/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ecto/issues/463/comments","events_url":"https://api.github.com/repos/elixir-lang/ecto/issues/463/events","html_url":"https://github.com/elixir-lang/ecto/issues/463","id":57704211,"number":463,"title":"UUID as primary key","user":{"login":"pynixwang","id":1189879,"avatar_url":"https://avatars.githubusercontent.com/u/1189879?v=3","gravatar_id":"","url":"https://api.github.com/users/pynixwang","html_url":"https://github.com/pynixwang","followers_url":"https://api.github.com/users/pynixwang/followers","following_url":"https://api.github.com/users/pynixwang/following{/other_user}","gists_url":"https://api.github.com/users/pynixwang/gists{/gist_id}","starred_url":"https://api.github.com/users/pynixwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pynixwang/subscriptions","organizations_url":"https://api.github.com/users/pynixwang/orgs","repos_url":"https://api.github.com/users/pynixwang/repos","events_url":"https://api.github.com/users/pynixwang/events{/privacy}","received_events_url":"https://api.github.com/users/pynixwang/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-14T19:45:43Z","updated_at":"2015-02-14T19:57:11Z","closed_at":"2015-02-14T19:57:11Z","body":"```elixir\r\ndefmodule Res.Category do\r\n  use Ecto.Model\r\n\r\n  @primary_key {:id, :uuid, [default: Ecto.UUID.generate |> Ecto.UUID.dump |> elem(1) |> Map.get :value ]}\r\n\r\n  schema \"category\" do\r\n    field :title, :string\r\n    timestamps\r\n  end\r\nend\r\n```\r\n\r\nI just want to set the default value of uuid field,but I get this long expression.\r\n\r\nI know I can use insert_before. but the expression is the same.\r\n\r\nand uuid representaion is so bad in iex.\r\n```\r\n%Res.Category{__state__: :loaded,\r\n id: <<91, 56, 40, 235, 9, 82, 67, 27, 129, 26, 224, 73, 136, 143, 131, 217>>,\r\n inserted_at: %Ecto.DateTime{day: 14, hour: 19, min: 34, month: 2, sec: 42,\r\n  year: 2015}, title: \"AAA\",\r\n updated_at: %Ecto.DateTime{day: 14, hour: 19, min: 34, month: 2, sec: 42,\r\n  year: 2015}}\r\n```\r\n\r\nsomething broken?"},"comment":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/comments/74389553","html_url":"https://github.com/elixir-lang/ecto/issues/463#issuecomment-74389553","issue_url":"https://api.github.com/repos/elixir-lang/ecto/issues/463","id":74389553,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2015-02-14T19:57:11Z","updated_at":"2015-02-14T19:57:11Z","body":"The default value is computed at compilation time, so yes, it will always be the same. Use before_insert instead."}}