Reputation: 23737
I have a method returning this:
format.json { render :json => @call, :include => :customer }
However, I want the @call.created_at
to return as a more readable datetime.
How can I do that?
thanks
Upvotes: 0
Views: 415
Reputation: 84150
You can create a method in your model to prettify the time.
class Call < ActiveRecord::Base
def formatted_time
#Pretty time
end
end
format.json { render :json => @call, :include => :customer, :methods => :formatted_time }
Upvotes: 1