Change ruby format to sql