modify for rails 3