Rails Helper functions to MySQL