Skip to content
Snippets Groups Projects
Commit a9d945a4 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

sent email when a suggestion is created or updated

parent c3a6f741
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ class V1::SuggestionsController < ApplicationController
@suggestion = Suggestion.new(suggestion_params)
if @suggestion.save
SuggestionsMailer.new_suggestion_received(@suggestion).deliver_now
render json: @suggestion, status: :created
else
render json: @suggestion.errors, status: :unprocessable_entity
......@@ -28,6 +29,7 @@ class V1::SuggestionsController < ApplicationController
# PATCH/PUT v1/suggestions/1
def update
if @suggestion.update(suggestion_params)
SuggestionsMailer.suggestion_updated(@suggestion).deliver_now
render json: @suggestion
else
render json: @suggestion.errors, status: :unprocessable_entity
......
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