mercredi 26 juillet 2017

How to use srtftime in views

Hi I am getting an error with strftime.

My views look like

<%=room.date%> works and yields "2017-07-27".

However I want to convert this to July 27, 2017.

<%= Date.parse(room.date).strftime("%B %e, %Y ") %> Does not work and causes the following error: ActionView::Template::Error (no implicit conversion of Date into String):

My schema has

t.date     "date"

I don't know what I am doing wrong. Thanks!

Aucun commentaire:

Enregistrer un commentaire