fixed 谭 domain bug in development environment.

This commit is contained in:
yanxd 2014-03-21 09:28:09 +08:00
parent 6198c3565b
commit 52fe99d71c
2 changed files with 186 additions and 179 deletions

View File

@ -1500,7 +1500,7 @@ module ApplicationHelper
end end
def render_dynamic_nav def render_dynamic_nav
home_link = link_to l(:field_homepage), "http://"+Setting.forge_domain+":3000" home_link = link_to l(:field_homepage), Setting.forge_domain.nil? ? nil : "http://"+Setting.forge_domain+":3000"
course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1,} course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1,}
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher'} course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher'}
courses_link = link_to l(:label_course_practice), {:host=>Setting.course_domain} courses_link = link_to l(:label_course_practice), {:host=>Setting.course_domain}

View File

@ -162,6 +162,13 @@ class Setting < ActiveRecord::Base
logger.info "Settings cache cleared." if logger logger.info "Settings cache cleared." if logger
end end
# fixed domain url in development. tantantan's bug
if Rails.env.development?
methods.map do |m|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
end
end
private private
# Returns the Setting instance for the setting named name # Returns the Setting instance for the setting named name
# (record found in database or new record with default value) # (record found in database or new record with default value)