demarches-normaliennes/app/controllers/commentaires_controller.rb

17 lines
575 B
Ruby
Raw Normal View History

2015-08-10 11:05:06 +02:00
class CommentairesController < ApplicationController
def create
2015-08-11 15:22:07 +02:00
@commentaire = Commentaire.new
2015-08-10 11:05:06 +02:00
@commentaire.email = params['email_commentaire']
@commentaire.body = params['texte_commentaire']
@commentaire.dossier = Dossier.find(params['dossier_id'])
@commentaire.save
2015-08-20 16:25:54 +02:00
if request.referer.include? '/recapitulatif'
2015-08-20 16:34:47 +02:00
redirect_to url_for(controller: :recapitulatif, action: :show, dossier_id: params['dossier_id'])
2015-08-10 11:05:06 +02:00
else
2015-08-20 16:34:47 +02:00
redirect_to url_for(controller: 'admin/dossier', action: :show, dossier_id: params['dossier_id'])
2015-08-10 11:05:06 +02:00
end
end
end