Hello,
This is a method that I have written to show personal messages. If the message that is requested is sent "to" the logged in user I will do another check and set status to opened if necessary. I can't figure out why the last "else" statement never executes if the first one is false: Message.find(params[:id], :conditions => {:from )
Code Ruby:def show if @message = Message.find(params[:id], :conditions => {:to => @user.id }) then if @message.status = "new" @message.status = "opened" @message.save end else @message = Message.find(params[:id], :conditions => {:from => @user.id }) end rescue ActiveRecord::RecordNotFound end







Bookmarks