29 lines
509 B
Ruby
29 lines
509 B
Ruby
class Public::MessagesController < ApplicationController
|
|
layout "public"
|
|
before_filter :auth_customer
|
|
|
|
def index
|
|
need = Need.find(params[:need_id])
|
|
end
|
|
|
|
def create
|
|
|
|
need = Need.find(params[:need_id])
|
|
|
|
@message = need.messages.create(comment_params)
|
|
@message.customer = current_customer
|
|
|
|
if(@message.save)
|
|
flash[:notice] = "Commentaire envoyé."
|
|
end
|
|
|
|
redirect_to public_need_path(need)
|
|
|
|
end
|
|
|
|
def comment_params
|
|
params.require(:message).permit(:content)
|
|
end
|
|
|
|
end
|