ruby on rails - Why doesn't Heroku like strftime? -


it seems heroku/postgresql doesn't support strftime. so, if want convert like:

@event.date_start.strftime("%b #{@event.date_start.day.ordinalize}") 

what options without using strftime?


edit:

here's heroku error log. it's stumbling on strftime, working fine in sqlite in dev environment:

2013-05-19t15:51:07.001968+00:00 app[web.1]: actionview::template::error (undefined method `strftime' nil:nilclass): 

the problem @event doesn't have date_start:

2013-05-19t15:51:07.001968+00:00 app[web.1]: actionview::template::error (undefined method `strftime' nil:nilclass) 

the above error means strftime being called on nil object, in case @event's date_start.

if event records should have date_start update or delete problematic one.
otherwise can use try:

@event.date_start.try(:strftime, "%b #{@event.date_start.day.ordinalize}") 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -