diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index ea9ad2cc0..c8aa33760 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -28,6 +28,7 @@ class Attachment < ActiveRecord::Base
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
# 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
+ has_many :forwards, :as => :from
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end
diff --git a/app/models/forward.rb b/app/models/forward.rb
new file mode 100644
index 000000000..c0dffd5e8
--- /dev/null
+++ b/app/models/forward.rb
@@ -0,0 +1,4 @@
+class Forward < ActiveRecord::Base
+ validates_presence_of :from_id, :from_type, :to_id, :to_type
+ belongs_to :from, :polymorphic => true
+end
\ No newline at end of file
diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb
index 146e643a0..84ddce252 100644
--- a/app/views/organizations/setting.html.erb
+++ b/app/views/organizations/setting.html.erb
@@ -59,9 +59,10 @@
http://
.trustie.net
申请
- <% if domain.present? and OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content == domain.subname %>
+ <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
+ <% if domain.present? and record.present? and record.content == domain.subname %>
(已批准)
- <% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %>
+ <% elsif record %>
(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)
<% end %>
diff --git a/db/migrate/20160224032046_create_forwards.rb b/db/migrate/20160224032046_create_forwards.rb
new file mode 100644
index 000000000..4404dc300
--- /dev/null
+++ b/db/migrate/20160224032046_create_forwards.rb
@@ -0,0 +1,15 @@
+class CreateForwards < ActiveRecord::Migration
+ def up
+ create_table :forwards do|t|
+ t.integer :from_id
+ t.string :from_type
+ t.integer :to_id
+ t.string :to_type
+ t.timestamp :created_at
+ end
+ end
+
+ def down
+ drop_table :forwards
+ end
+end