如何在Keystone.js数据库ODM中创建字符串数组?我必须用单场创建新模型并且many:true只与他建立关系?
我使用Mongoid的githead版本(因为Rails 4),我想创建一个字段所需的文档:
class MyClass
include Mongoid::Document
field :name, type: String, required: true
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
Problem: Invalid option :required provided for field :name. Summary: Mongoid requires that you only provide valid options on each field definition in order to prevent un...
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我想在发生第一个任务错误后停止执行我的async.queue.我需要与并发限制并行执行几个类似的操作,但在第一次出错后停止所有操作.我怎么能这样做或者我应该用什么呢?
我希望应用程序的用户可以更改我的play2(播放2.1.1,scala 2.10.1)Web应用程序中的语言.我在i18n的模板中使用了@ Messages.get(...).
我有
application.langs="en,ru"
Run Code Online (Sandbox Code Playgroud)
在application.conf中.我将"en"或"ru"传递给该方法:
def index = Action {
Ok(views.html.index())
}
def changeLanguage(lang:String) = Action {
implicit request =>
Logger.logger.debug("Change user lang to : " + lang)
val referrer = request.headers.get(REFERER).getOrElse(HOME_URL)
Redirect(referrer).withLang(Lang(lang))
}
Run Code Online (Sandbox Code Playgroud)
路线:
GET / controllers.Application.index
GET /index controllers.Application.changeLanguage(lang ?= "ru")
Run Code Online (Sandbox Code Playgroud)
模板束(views.html.index):
@()(implicit l: Lang)
@import play.i18n.Messages
...
<a href="/about">@Messages.get("about")</li>
...
<a href="index?lang=ru" id="ru"></a>
<a href="index?lang=en" id="en"></a>
...
Run Code Online (Sandbox Code Playgroud)
重定向页面后,我用同一种语言看到它.:(
我读了许多旧答案:我的模板中的隐式语言参数不起作用,重定向或带有withLang(...)方法调用的操作也是如此.这么长时间没有好的解决方案?
我的/lib/router.coffee中有一个简单的铁路由器配置:
Router.configure
notFoundTemplate: "notFound"
Router.map ->
@route "app",
path: "/"
template: "app"
Run Code Online (Sandbox Code Playgroud)
当进入/它的工作,但如果我尝试转到/ abc然后它重定向我/#!abc,之后它重定向我/ abc,所以无休止地重复(我在浏览器的地址栏中看到这些更改,在浏览器日志重定向中从/到/ abc和后面).我从来没有看到404错误.
有没有人遇到过这种行为?
我使用Meteor v1.0.2.1.有我的流星列表:
alethes:lodash 0.7.1
appcache 1.0.3
coffeescript 1.0.5
ground:localstorage 0.1.7
ground:store 0.1.1
ianhorst:bower 0.0.2
iron:router 1.0.6
meteor-platform 1.2.1
meteorhacks:kadira 2.15.2
peerlibrary:async 0.9.0_3
rzymek:moment 2.8.3_10
rzymek:moment-locale-ru 2.8.4
Run Code Online (Sandbox Code Playgroud)
我也在客户端使用Framework7.
routing web-applications meteor iron-router html-framework-7
node.js ×2
asynchronous ×1
iron-router ×1
keystonejs ×1
meteor ×1
mongodb ×1
mongoid ×1
mongoose ×1
orm ×1
routing ×1
ruby ×1
scala ×1
templates ×1
web ×1