[英]How does a Rails app set it's Environment (Dev., Staging, etc.)?
[英]How to solve Rails environment difference? Works in staging but not in dev
我有一個較大的Rails應用程序中的ribs.js應用程序中的儀表板。 在登台和生產中(在heroku上),儀表板可以正常工作。
但是,在我的本地Pow開發環境中,當我嘗試查看特定的儀表板時,在瀏覽器控制台中出現以下錯誤:
Uncaught TypeError: Object #<Object> has no method 'merge'
跟蹤一點之后,這就是我的想法。 錯誤消息中引用的合並方法來自渲染的/assets/templates/dashboard/details.js文件。 這是在第5行開始時瀏覽器正在調用錯誤的代碼:helpers = this.merge ...:
(function() {
this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
this.HandlebarsTemplates["dashboard/details"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
buffer += "<p>\n <b>Name:</b>\n <span class='editable' data-attribute-name='name'>";
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "</span>\n</p>\n<p>\n <b>Description:</b>\n <span class='editable' data-attribute-name='description'>";
if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "</span>\n</p>\n<p>\n <button class='add_module'>Add module</button>\n</p>\n";
return buffer;
});
return this.HandlebarsTemplates["dashboard/details"];
}).call(this);
我認為這是Rails預編譯或資產管道設置的問題,因為它在暫存和生產中運行良好,但在本地開發中卻失敗。
必須將任何更改推送到heroku來測試它們實在是太糟糕了。 任何解決此問題的建議表示贊賞。
看來這是由於我的車把版本過舊造成的。 多虧了Thoughtbot伙計們幫助我們追蹤了這一點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.