diff options
Diffstat (limited to 'app/controllers/pms_controller.rb')
-rw-r--r-- | app/controllers/pms_controller.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb index 11f51c8..c83d2ae 100644 --- a/app/controllers/pms_controller.rb +++ b/app/controllers/pms_controller.rb @@ -1,6 +1,4 @@ class PmsController < ApplicationController - before_action :set_pm, only: [:show, :edit, :update, :destroy] - # GET /pms # GET /pms.json def index @@ -25,6 +23,12 @@ class PmsController < ApplicationController # POST /pms.json def create @pm = Pm.new(pm_params) + @pm.author = current_user + #require 'pp' + #pp @pm.message + @pm.recipient = User.find_by_user_name(pm_params['recipient_id']) + + @pm.conversation = @pm.author.send_message(@pm.recipient, @pm.message, @pm.subject).conversation respond_to do |format| if @pm.save @@ -37,6 +41,10 @@ class PmsController < ApplicationController end end + #def reply + # current_user.reply_to_conversation(conversation, message) + #end + # PATCH/PUT /pms/1 # PATCH/PUT /pms/1.json def update |