model中添加获取二级域名的方法

This commit is contained in:
huang 2016-05-17 09:02:17 +08:00
parent 5ee6c9e5d3
commit 13cc5ceaa6
2 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ class Organization < ActiveRecord::Base
self.allow_teacher.to_i == 1 ? true : false
end
def secdomain
def secdomain_name
Secdomain.where("sub_type=2 and pid=?", self.id).first.try(:subname)
end
end

View File

@ -114,7 +114,7 @@
<% if @organization.secdomain.nil? %>
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<% else %>
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript secdomain_with_protocol(@organization.secdomain) + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript secdomain_with_protocol(@organization.secdomain_name) + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<% end %>
<div id="principals_for_new_member">