ajax message fix

This commit is contained in:
yanxd 2013-12-26 08:39:43 +08:00
parent 64d85a9ab2
commit 605d7ec565
2 changed files with 4 additions and 2 deletions

View File

@ -41,8 +41,8 @@ class WordsController < ApplicationController
end
def create_reply
user_id_str = request.headers["Referer"].match((%r|/[0-9]{1,}/|))[0]
user_id = user_id_str[1, user_id_str.size-2]
# deny api. api useless
user_id = request.headers["Referer"].match((%r|/([0-9]{1,})/|))[1]
@user = User.find(user_id)
parent_id = params[:reference_id]
author_id = User.current.id

View File

@ -26,6 +26,8 @@ class JournalsForMessage < ActiveRecord::Base
after_create :act_as_activity #huang
after_create :reset_counters!
after_destroy :reset_counters!
default_scope { where('m_parent_id IS NULL') }
def self.delete_message(message_id)
self.delete_all "id = #{message_id}"