From ab6316a1cf8ae19360242aa5f2e8cf1c41413394 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Tue, 3 Jul 2012 22:43:22 -0500 Subject: [PATCH] add link on user profile to send them a message (kind of ugly) --- app/controllers/messages_controller.rb | 4 ++++ app/views/users/show.html.erb | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 1bf4957..b4e8b99 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -4,6 +4,10 @@ class MessagesController < ApplicationController def index @new_message = Message.new + + if params[:to] + @new_message.recipient_username = params[:to] + end end def create diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index a8f8d4a..95e4978 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,7 +1,10 @@
-
- <%= @showing_user.username %> -
+
+ <%= @showing_user.username %> + <% if @user %> + (Send a Message) + <% end %> +