Skip to content
Snippets Groups Projects
Commit f2f1f6e8 authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira
Browse files

Merge branch 'issue/18-fix-contacts-route' into 'develop'

Issue#18: FIX contacts route

See merge request rfhf19/cleanning-portalmec!16
parents 24df39e1 f5464b3a
No related branches found
No related tags found
2 merge requests!17Curatorship and Gamification done,!16Issue#18: FIX contacts route
Pipeline #31766 failed
......@@ -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
......@@ -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)
......
env 0 → 100644
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment