Rails Public Service Announcement
For anyone trying to ordinalize a date in Rails (that is, display a date as “September 18th”), various tutorials or code snippets will have you do something like this:
<%= date.strftime("%B #{date.day.ordinalize}") %>
Note that that code uses double quotes. If you use single quotes in your code …
<%= date.strftime('%B #{date.day.ordinalize}') %>
… Rails won’t render it correctly. It’ll render your “September 18th” as “September #{date.day.ordinalize}”, which is, probably, not what you want.
It’s kind of embarrassing how long it’s taken me to figure that out. But there you go.
Update: I should have noted: this actually applies across the board in Rails. Double-quotes if you want Rails to execute something within the block; single-quotes if you want it to output a string. It’s not limited to ordinal dates and whatnot.