RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: BMorearty
One other thing to do: replace all occurrences of <% form_for ... with <%= form_for ....
<% form_for ...
<%= form_for ...
I like using the idea of using the Accepts header for versioning, although it does make it harder to test API versions from a browser's URL bar.
But there's a bug in this code that will be exposed once you reach v10. matches?(req) will return true when the router asks if the request is for v1, because 'application/vnd.example.v10'.includes?('application/vnd.example.v1') is true.
One way to fix this is to reverse the order of your routes file: put newer versions at the top, not at the bottom.
Hey Ryan, at the end when talking about Compass Reset and Normalize you mentioned that trying to make all browsers consistent isn't necessarily required for every website.
I agree with you that it's not necessary to have your site look exactly the same, down to the pixel, across browsers. I've had to convince designers that trying to achieve that is a waste of time. But still, do you ever find yourself sometimes wishing your spacing were a little more consistent on different browsers because you didn't always start by normalizing the CSS? And then wasting some time fixing up the differences introduced by normalizing later?
Keep up the good work. The pro episode you mentioned about deploying, nginx, Unicorn, etc. looks like it could be really useful.
@Ryan and @Geoff,
Even though Time.zone is thread-local, that won't prevent it from leaking from one request to a subsequent request on the same thread.
Here's the fix for that: