Rails model specific Date formating
<p>I have two models namely <strong>post</strong> and <strong>comment</strong>. Each model have a field named <strong>created_at</strong> with data type <strong>date</strong>, while rendering the json response i need to format the created_at field but it is different for both models. </p>

<p>for the model Post the format must be <strong>May 12 2016</strong> </p>

<p>for the comment model format is <strong>05-12-2016</strong></p>

<p>is there any options for specifying the format with specific to model ?</p>

<p>And I don't want to have additional function because i have used to display date in different places, so if i write a function i need to change it in all places. </p>