lumi-api/app/controllers/piratas_controller.rb

23 lines
609 B
Ruby
Raw Normal View History

2019-04-05 22:14:20 +00:00
# frozen_string_literal: true
# Las piratas son las que activan el Miniloom
class PiratasController < ApplicationController
2019-04-06 20:41:44 +00:00
# POST /piratas
#
2019-04-05 22:14:20 +00:00
# Registra una cuenta
2019-04-06 20:41:44 +00:00
#
# @param pirata [Hash] { pirata: { password: @string, email: @string,
# nick: @string } }
# @return [Hash] { id: @int, nick: @string, email: @string }
2019-04-05 22:14:20 +00:00
def create
@pirata = Pirata.new(params
.require(:pirata)
.permit(:email, :nick, :password))
return if @pirata.save
2019-04-20 15:49:31 +00:00
render json: { errors: @pirata.errors.messages },
2019-04-05 22:14:20 +00:00
status: :unprocessable_entity
end
end