functionality working after converting to sinatra app to rails