first version for rails 3