ajax message fix
This commit is contained in:
parent
64d85a9ab2
commit
605d7ec565
|
@ -41,8 +41,8 @@ class WordsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_reply
|
def create_reply
|
||||||
user_id_str = request.headers["Referer"].match((%r|/[0-9]{1,}/|))[0]
|
# deny api. api useless
|
||||||
user_id = user_id_str[1, user_id_str.size-2]
|
user_id = request.headers["Referer"].match((%r|/([0-9]{1,})/|))[1]
|
||||||
@user = User.find(user_id)
|
@user = User.find(user_id)
|
||||||
parent_id = params[:reference_id]
|
parent_id = params[:reference_id]
|
||||||
author_id = User.current.id
|
author_id = User.current.id
|
||||||
|
|
|
@ -27,6 +27,8 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
after_create :reset_counters!
|
after_create :reset_counters!
|
||||||
after_destroy :reset_counters!
|
after_destroy :reset_counters!
|
||||||
|
|
||||||
|
default_scope { where('m_parent_id IS NULL') }
|
||||||
|
|
||||||
def self.delete_message(message_id)
|
def self.delete_message(message_id)
|
||||||
self.delete_all "id = #{message_id}"
|
self.delete_all "id = #{message_id}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue