first working version with rails 3