我有一个涉及几个不同框架/库的问题,尽管主要是Twitter Bootstrap(js)和Rails.
我在我的应用程序中有一个链接响应一些js:
$(function() {
var $modal = $('<%= escape_javascript( render 'front_end/bookings/modal', :product => @product, :customer => @customer, :booking => @booking ) %>'),
$calendar = $modal.find('#calendar'),
currentProduct = <%= raw(@product.to_json) %>;,
initBookingCalendar;
$('body').append($modal);
$modal.modal('show');
/* Booking Calendar */
initBookingCalendar = function(el, productId) {
el.fullCalendar()
...
};
$($modal).on('shown', function() {
if($calendar.is(':empty')) {
initBookingCalendar($calendar, <%= @product.id %>);
}
});
});
Run Code Online (Sandbox Code Playgroud)
问题是'显示'事件不会因为某些原因在IE9中触发!?我在这里重现了这个问题:http://jsfiddle.net/tvkS6/并通过这样做得到它:http://jsfiddle.net/tvkS6/9/.问题是我不知道如何在我的代码中实现解决方案,因为我真的不明白问题是什么.
我必须等待initBookingCalendar直到完全显示模式的原因是jQuery FullCalendar插件要求在呈现日历之前元素可见.
任何提示都表示赞赏!
jquery ruby-on-rails fullcalendar twitter-bootstrap jquery-events
我有一个多租户Rails应用程序,由Heroku在http://myapp.herokuapp.com托管.租户/帐户通过子域(和Postgresql架构)分开.然后我将自己的域作为自定义域添加到Heroku应用程序中.由于Heroku真的建议不要使用A记录,因为"正常运行时间影响"(https://devcenter.heroku.com/articles/avoiding-naked-domains-dns-arecords)我首先尝试将CNAME记录从我的自定义域中添加到myapp.herokuapp.com.这也适用于像http://clientaccount.mydomain.com这样的子域名.
当我的客户希望她自己的域指向他们的帐户以便http://www.clientdomain.com显示http://clientaccount.mydomain.com时,问题就出现了,最明显的解决方案似乎是在我的帐户中创建一个CNAME记录客户端DNS指向http://clientaccount.mydomain.com.这不起作用,当访问地址时出现错误消息"没有在该主机名配置应用程序"时,也host www.clientdomain.com给出了:
www.clientdomain.com is an alias for clientaccount.mydomain.com
clientaccount.mydomain.com is an alias for myapp.herokuapp.com
myapp.herokuapp.com is an alias for ar.herokuapp.com
Run Code Online (Sandbox Code Playgroud)
在Heroku的一些非常困惑的支持之后,他们建议我使用A记录而不是指向他们的三个顶点IP.所以改了它但它仍然没有用.然后他们告诉我在我的Heroku设置中将我的客户域添加为自定义域,我没有做好结果.
所以我目前的配置如下:
*.mydomain.com www.clientdomain.com
*.mydomain.com有三条指向Heroku顶点IP的A记录
在clientdomain.com的DNS中,clientdomain.com(没有www)被重定向到www.clientdomain.com(不确定他们是如何做到的,但似乎有效.)
对于www.clientdomain.com,有一条指向clientaccount.mydomain.com的CNAME记录
www.mydomain.com正确解析.
clientaccount.mydomain.com正确解析.
www.clientdomain.com访问www.mydomain.com(不带子域名)
所以问题是在DNS中以某种方式显而易见,因为我的应用程序显然没有收到它,所以子域是否会在某处掉落?或者我是否必须更改Rails中的一些代码才能处理这个问题?
子域作为路由约束处理,子域类:
class Subdomain
def self.matches?(request)
request.subdomain.present? && Account.find_by_subdomain(request.subdomain)
end
end
Run Code Online (Sandbox Code Playgroud)
任何输入都表示赞赏!
我已经完成了所有建议,我是否也必须更改我的应用程序控制器?
application_controller.rb
def handle_subdomain
if @account = Account.find_by_subdomain(request.subdomain)
PgTools.set_search_path @account.id
@current_account = @account
else
@current_account = …Run Code Online (Sandbox Code Playgroud)