Re: Rails Messaging (INBOX) system

Hello! Great tutorial. I have implemented it into my app, but i was wondering about one more feature. I want to place a link on a user's public profile page that says, "Message this User."
I was wondering how to make it so that if another user clicks on that link, it will create a new sent message addressed to that user.

Has anyone implemented a feature like this? any ideas?

Re: Rails Messaging (INBOX) system

Has anyone managed to get it working with Restful Authentication as I'm getting a "stack level too deep" error?

Re: Rails Messaging (INBOX) system

cjmiyake wrote:

Hello! Great tutorial. I have implemented it into my app, but i was wondering about one more feature. I want to place a link on a user's public profile page that says, "Message this User."
I was wondering how to make it so that if another user clicks on that link, it will create a new sent message addressed to that user.

Has anyone implemented a feature like this? any ideas?

If you add

@message = current_user.sent_messages.build(:to => params[:to])

in your sent_controller file under the 'new' action, you can then call http://localhost:3000/sent/new?to=oli and it would pre fill your to field...

Last edited by olivier (2008-06-22 16:47:30)

Re: Rails Messaging (INBOX) system

i'm having the same problem regarding messages that were deleted still showing up in the inbox.  has anyone figured out a nice, DRY way to fix this problem?  i can do it by duplicating code, but it's ugly and i know there has to be an easier way.  one of the last posts was a little too vague in his solution to the problem.  thanks.

Re: Rails Messaging (INBOX) system

got it.  i missed the subtle change to the MailboxController:

def show
    @folder ||= current_user.folders.find(params[:id])
    @messages = @folder.messages.paginate_not_deleted :all, :per_page => 10, :page => params[:page],
          :include => :message, :order => "messages.created_at DESC"
end

thanks.  great tutorial.

Re: Rails Messaging (INBOX) system

olivier wrote:
cjmiyake wrote:

Hello! Great tutorial. I have implemented it into my app, but i was wondering about one more feature. I want to place a link on a user's public profile page that says, "Message this User."
I was wondering how to make it so that if another user clicks on that link, it will create a new sent message addressed to that user.

Has anyone implemented a feature like this? any ideas?

If you add

@message = current_user.sent_messages.build(:to => params[:to])

in your sent_controller file under the 'new' action, you can then call http://localhost:3000/sent/new?to=oli and it would pre fill your to field...

Also, if you do something like:

class SentController < ApplicationController
  def new
    @users = []
    unless params[:to] == nil
      @users << User.find(params[:to])
    else
      @users = User.find(:all)
    end
    @message = current_user.sent_messages.build(:to => params[:to])
  end
end

and change the select helper in sent/new to:

<%= options_from_collection_for_select(@users, :id, :login, @message.to) %>

then the select box will only include the user specified when you click the link from their profile

to be fair there's probably a neater way to do it

Re: Rails Messaging (INBOX) system

This is a great tutorial!
I've followed the whole tutorial and it works perfectly. I was thinking of adding an upload and download attachment feature. I have an idea about the upload option but how to allow a user to download the attachment?
attachment could be .jpeg, .pdf, .doc.
Appreciate any help on this smile

Re: Rails Messaging (INBOX) system

*bump*
please help me out here fellas!

Re: Rails Messaging (INBOX) system

Someone could please updload a new tutorial link?
It seems broken