F
F
FreezkoSS2018-05-27 10:48:05
Ruby on Rails
FreezkoSS, 2018-05-27 10:48:05

How to validate form fields without a model?

But since there is no model, I don't even know how to implement it. Here is the controller code:
class ZamsController < ApplicationController
def index
@clue = params[:name] + "." + params[:city] + "." + params[:phone1] + "." + params[:email]
ZamsMailer.zayavka(@clue).deliver
redirect_to root_path, success: 'Request sent successfully!'
end
end
Is there any other way to implement validation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Ponomarev, 2018-06-10
@ilyario

Read about the FormObject pattern
https://robots.thoughtbot.com/activemodel-form-objects

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question