Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
f763fcf144
|
@ -70,20 +70,22 @@ class WordsController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
|
||||
if @journal_destroyed.jour_type == "Bid"
|
||||
@bid = Bid.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
elsif @journal_destroyed.jour_type == "Course"
|
||||
@course = Course.find @journal_destroyed.jour_id
|
||||
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
elsif @journal_destroyed.jour_type == "Principal"
|
||||
@user = User.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
@is_user = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
@journal_destroyed = JournalsForMessage.find params[:object_id]
|
||||
if @journal_destroyed.destroy
|
||||
if @journal_destroyed.jour_type == "Bid"
|
||||
@bid = Bid.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
elsif @journal_destroyed.jour_type == "Course"
|
||||
@course = Course.find @journal_destroyed.jour_id
|
||||
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
elsif @journal_destroyed.jour_type == "Principal"
|
||||
@user = User.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
@is_user = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# 消息关联
|
||||
has_many :course_messages, :class_name => 'CourseMessage',:as =>:course_message ,:dependent => :destroy
|
||||
has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:user_feeback_message, :dependent => :destroy
|
||||
has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:journals_for_message, :dependent => :destroy
|
||||
|
||||
validates :notes, presence: true, if: :is_homework_jour?
|
||||
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message
|
||||
|
|
21
db/schema.rb
21
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150820004659) do
|
||||
ActiveRecord::Schema.define(:version => 20150820025358) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -776,16 +776,6 @@ ActiveRecord::Schema.define(:version => 20150820004659) do
|
|||
|
||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_details_copy", :force => true do |t|
|
||||
t.integer "journal_id", :default => 0, :null => false
|
||||
t.string "property", :limit => 30, :default => "", :null => false
|
||||
t.string "prop_key", :limit => 30, :default => "", :null => false
|
||||
t.text "old_value"
|
||||
t.text "value"
|
||||
end
|
||||
|
||||
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_replies", :id => false, :force => true do |t|
|
||||
t.integer "journal_id"
|
||||
t.integer "user_id"
|
||||
|
@ -1414,6 +1404,15 @@ ActiveRecord::Schema.define(:version => 20150820004659) do
|
|||
t.integer "fields_bits", :default => 0
|
||||
end
|
||||
|
||||
create_table "user_activities", :force => true do |t|
|
||||
t.string "act_type"
|
||||
t.integer "act_id"
|
||||
t.string "container_type"
|
||||
t.integer "container_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "user_extensions", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.date "birthday"
|
||||
|
|
Loading…
Reference in New Issue