adapt to rails 3