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
|
|
|
|
|
|
|
|
render json: { errors: @pirata.errors.full_messages },
|
|
|
|
status: :unprocessable_entity
|
|
|
|
end
|
|
|
|
end
|