消息列表中的at消息报500
This commit is contained in:
parent
3d7d8c5795
commit
f4632c432f
|
@ -521,10 +521,10 @@ class IssuesController < ApplicationController
|
||||||
def delete_journal
|
def delete_journal
|
||||||
@issue = Issue.find(params[:id])
|
@issue = Issue.find(params[:id])
|
||||||
begin
|
begin
|
||||||
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id]).first
|
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
|
||||||
forge_acts.destroy unless forge_acts.nil?
|
forge_acts.destroy_all unless forge_acts.empty?
|
||||||
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id]).first
|
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id])
|
||||||
at_message.destroy unless at_message.nil?
|
at_message.destroy_all unless at_message.empty?
|
||||||
Journal.delete(params[:journal_id])
|
Journal.delete(params[:journal_id])
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts e
|
puts e
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
class DeleteNullAtMessages < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = AtMessage.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
AtMessage.page(i).per(30).each do |am|
|
||||||
|
if am.at_message.nil?
|
||||||
|
am.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20160824073554) do
|
ActiveRecord::Schema.define(:version => 20160830090214) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue