Updated helper with rails code