Phoenix framework - Custom changeset validations
<p>I'm really new to phoenix and elixir, so my apologies if these seem like simple questions. I've searched stack overflow and blogs before I thought about posting it here.</p>

<p>I've got 2 fields in a model, field A : integer and field B : integer. When doing my validations with my changeset I want to create a custom validation that checks if field A is more than field b when creating a new item, and if so then flash a error message and bring them back to the :new route. Sorry if I'm not using the right terminologies.</p>

<p>So I guess this now becomes a 2 part question. First, should I even be doing this in my model by creating a custom validation or should this be in the controller? And second, what is the simplest way to write this in phoenix?</p>

<p>Thanks once again.</p>