From 07f130f0a68f5eb806338d379031a49866966cd6 Mon Sep 17 00:00:00 2001 From: Nick Black Date: Mon, 7 May 2007 14:14:51 +0000 Subject: [PATCH] fixed user messaging stuff --- app/controllers/message_controller.rb | 5 +++-- app/views/user/account.rhtml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/message_controller.rb b/app/controllers/message_controller.rb index a2245ce86..a95ad25b6 100644 --- a/app/controllers/message_controller.rb +++ b/app/controllers/message_controller.rb @@ -6,16 +6,17 @@ class MessageController < ApplicationController def new if params[:message] - to_user = User.find_by_display_name(params[:display_name]) + to_user = User.find(params[:user_id]) body = params[:message][:body] title = params[:message][:title] message = Message.new message.body = body message.title = title - message.to_user_id = to_user.id + message.to_user_id = params[:user_id] message.from_display_name = to_user.display_name message.from_user_id = @user.id message.sent_on = Time.now + if message.save flash[:notice] = 'Message sent' else diff --git a/app/views/user/account.rhtml b/app/views/user/account.rhtml index 6b18466ba..60e5e009d 100644 --- a/app/views/user/account.rhtml +++ b/app/views/user/account.rhtml @@ -37,7 +37,7 @@ <%= link_to nearby.display_name, :controller => 'user', :action => 'view', :display_name => nearby.display_name %> - <%= link_to 'send message', :controller => 'message', :action => 'new', :display_name => nearby.display_name %> + <%= link_to 'send message', :controller => 'message', :action => 'new', :user_id => nearby.id %> <%end%> -- 2.39.5