From f5464b3a39613beb06a70bbc9e00f6eb21438f25 Mon Sep 17 00:00:00 2001 From: luandalmazo <lmtd21@inf.ufpr.br> Date: Fri, 4 Nov 2022 09:59:18 -0300 Subject: [PATCH] Issue#18: FIX contacts route --- app/controllers/v1/contacts_controller.rb | 12 ++++++------ app/mailers/contacts_mailer.rb | 4 ++-- env | 0 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 env diff --git a/app/controllers/v1/contacts_controller.rb b/app/controllers/v1/contacts_controller.rb index 8680c4914..48ddb1558 100644 --- a/app/controllers/v1/contacts_controller.rb +++ b/app/controllers/v1/contacts_controller.rb @@ -22,13 +22,13 @@ class V1::ContactsController < ApplicationController before_action :authenticate_user!, except: [:create] before_action :set_contact, only: [:show, :update, :destroy] - before_action :set_new_contact, only: :index + before_action :set_new_contact, only: :index before_action :authorize!, except: [:create] # GET v1/contacts def index contacts = paginate policy_scope(Contact) - render json: contacts + render json: contacts end # GET v1/contacts/1 @@ -82,8 +82,8 @@ class V1::ContactsController < ApplicationController def authorize! authorize @contact end - - def set_new_contact - @contact ||= Contact.new - end + + def set_new_contact + @contact ||= Contact.new + end end diff --git a/app/mailers/contacts_mailer.rb b/app/mailers/contacts_mailer.rb index 35764830b..385967ee1 100644 --- a/app/mailers/contacts_mailer.rb +++ b/app/mailers/contacts_mailer.rb @@ -18,12 +18,12 @@ # along with portalmec. If not, see <http://www.gnu.org/licenses/>. class ContactsMailer < ApplicationMailer - default from: Proc.new { @contact.email } + default to: 'portalmec@inf.ufpr.br' def new_contact_received(contact) @contact = contact @subject = "Contato de " + @contact.name - mail(subject: @subject) + mail(from: @contact.email, subject: @subject) end def contact_updated(contact) diff --git a/env b/env new file mode 100644 index 000000000..e69de29bb -- GitLab