Fix bug on Rails 3