{"action":"closed","issue":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/545","labels_url":"https://api.github.com/repos/elixir-lang/ecto/issues/545/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ecto/issues/545/comments","events_url":"https://api.github.com/repos/elixir-lang/ecto/issues/545/events","html_url":"https://github.com/elixir-lang/ecto/issues/545","id":65477393,"number":545,"title":"Add conditionals to callbacks","user":{"login":"mschae","id":473241,"avatar_url":"https://avatars.githubusercontent.com/u/473241?v=3","gravatar_id":"","url":"https://api.github.com/users/mschae","html_url":"https://github.com/mschae","followers_url":"https://api.github.com/users/mschae/followers","following_url":"https://api.github.com/users/mschae/following{/other_user}","gists_url":"https://api.github.com/users/mschae/gists{/gist_id}","starred_url":"https://api.github.com/users/mschae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mschae/subscriptions","organizations_url":"https://api.github.com/users/mschae/orgs","repos_url":"https://api.github.com/users/mschae/repos","events_url":"https://api.github.com/users/mschae/events{/privacy}","received_events_url":"https://api.github.com/users/mschae/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-31T15:24:43Z","updated_at":"2015-03-31T15:27:26Z","closed_at":"2015-03-31T15:27:26Z","body":"Hey,\r\n\r\nhow do you feel about conditionals for callbacks. E.g.\r\n\r\n```Elixir\r\ndefmodule User do\r\n  use Ecto.Model\r\n\r\n  struct \"users\" do\r\n    field :username\r\n    field :email\r\n  end\r\n\r\n  after_insert :send_welcome_email, if: &Dict.has_key?(&1.changes, :email)\r\nend\r\n```"}}