Add compatibility for Rails 3