9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/ish_manager/email_contexts_controller.rb', line 9
def create
@ctx = ::Ish::EmailContext.new params[:ctx].permit!
@tmpl = ::Ish::EmailTemplate.find @ctx.email_template_id
@ctx.from_email ||= @tmpl.from_email
@ctx.subject ||= @tmpl.subject
authorize! :create, @ctx
if @ctx.save
flash[:notice] = 'Saved.'
redirect_to action: 'show', id: @ctx.id
return
else
flash[:alert] = ['Could not save:'] + @ctx.errors.full_messages
render action: :new
return
end
end
|