convert to rails-api