I have a column type date (shown from annotate) on my Contacts table:
# date_entered :date(255)
This is the line of code that has worked for me locally on my sqlite3 database, but now generates an error in Heroku:
<%= contact.date_entered.to_s(:long) %>
The error that I get is:
wrong number of arguments (1 for 0)
I removed the :long component and it appears to work, but now, of course, looks badly formatted.
How do I address this?
Use
for date formatting.
Also you can override to_s method for Date/Time to use I18n localization:
In this case can use both :logn (:default, :short) and ‘%d %B, %Y’ formats.
UPD:
Also it makes sense to store old method and call it in case you don’t pass any params: