Hi guys. I just realized that I cannot render anything from a controller and that’s good cuz rendering belongs to other layers of MVC but look at the code
I attached below and help me please find out a way to solve my problem.
# POST /sign-up ---> creates a user
# GET /sign-up ----> shows a sign up form, controller: Web::Controllers::Registrations::New
module Web::Controllers::Registrations
class Create
include Web::Action
params do
param :user do
param :email, type: String, presence: true
param :password, type: String, presence: true, confirmation: true
end
end
def call(params)
if params.valid?
# a user creation code
#
# HOWTO: render a page that the user was created successfuly
# CAN_BE: redirect_to '/user-created'
else
# HOWTO: render "sign up" page with errors under each input element
# like password should be at least 8 symbols long and yada and yada
end
end
end
end