1.解决组织配置报500的错误;2.增加转发表

This commit is contained in:
ouyangxuhua 2016-02-24 16:01:32 +08:00
parent 3eb7c62b85
commit 11231d0ff9
4 changed files with 23 additions and 2 deletions

View File

@ -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

4
app/models/forward.rb Normal file
View File

@ -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

View File

@ -59,9 +59,10 @@
<div class="w607 fr">http//
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" />
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<% 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 %>
<span>(已批准)</span>
<% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %>
<% elsif record %>
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
<% end %>
<p class="c_green f12" id="apply_hint" ></p></div>

View File

@ -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