Notes posted by jmcnevin
RSS feedTime.now in views.
Be careful if you use Time.now in views with time zone support enabled, as this will not actually do the time zone conversion.
Instead, use Time.zone.now.
Make sure your action names don't step on any toes.
In my experience, if you ever have a controller action named “process”, your controller will cease to function, as there is both a class and instance method called process in ActionController::Base.
There are undoubtedly other action names that will cause conflicts, but this one is particular I’ve run into a number of times.
Writing and reading a cookie in the same request.
Note that when setting the value of a cookie, the new value won’t be accessible until the next page request. In this way, the cookies hash cannot be used in the same manner as the session hash.
For example:
# given that cookies[:temporary_data] was set to 'foo' in the previous request cookies[:temporary_data] = 'bar' p cookies[:temporary_data] # => 'foo'