我需要使用自定义"data-*"属性标记我的Elm.Http元素,例如:
<tr data-row="1">...</tr>
Run Code Online (Sandbox Code Playgroud)
我尝试过以下方法:
import Html exposing (..)
import Html.Attributes exposing (..)
import Json.Encode as JsEncode
view ... =
tr [ property "data-row" (JsEncode.string (toString 1)) ]
Run Code Online (Sandbox Code Playgroud)
但这没有任何作用.有人知道吗?
我认为问题是Elm实际上是在设置JavaScript DOM属性,所以我真的想以某种方式调用element.dataset.row ="1".
背景是我需要为我的事件处理程序向jQuery公开一些数据,因为Elm事件库缺少一些我需要的功能,例如条件化的preventDefault和表单序列化.还有其他方法可以通过DOM提供数据,但data-*属性是迄今为止最简单的.
编译我的应用程序时,我突然收到此错误消息:
elm make src/App.elm --output ../assets/javascripts/elm/App.js
elm: not enough bytes
CallStack (from HasCallStack):
error, called at libraries/binary/src/Data/Binary.hs:212:21 in binary-0.8.5.1:Data.Binary
make: *** [App.js] Error 1
Run Code Online (Sandbox Code Playgroud)
编译错误?
编辑:解决方法是删除elm-stuff.然后它将编译一次,并在下次尝试时具有相同的错误.
当我运行大量 Capybara“系统”测试时,自动 Chrome 窗口不断成为焦点!这基本上意味着我在测试运行时无法工作。这让我发疯。有什么我可以做的吗?直到最近它才这样做。
宝石:
ruby-on-rails capybara selenium-chromedriver ruby-on-rails-5
Spring Boot 中是否有某种方法可以对依赖于彼此值的属性执行验证,并使错误消息与该属性关联?
我想以漂亮的 JSON 结构将错误返回给用户:
{
"errors": {
"name": "is required if flag is true"
}
}
Run Code Online (Sandbox Code Playgroud)
例子:
@Entity
public class MyEntity {
private boolean nameRequiredFlag;
// Required if "nameRequiredFlag" is set to true:
private String name;
}
Run Code Online (Sandbox Code Playgroud)
无法解决将错误消息与 name 属性关联的问题的一种解决方案是为实体创建验证器注释:
@ValidEntity
public class MyEntity {
private boolean nameRequiredFlag;
// Required if "nameRequiredFlag" is set to true:
private String name;
}
@Constraint( validatedBy = { MyEntityValidator.class } )
@Documented
@Target( { ElementType.TYPE } )
@Retention( RetentionPolicy.RUNTIME )
public …Run Code Online (Sandbox Code Playgroud) 我正在尝试在生产模式下测试我的 Rails 5.1 站点。我有预编译的资产,并设置了这个配置选项:config.public_file_server.enabled = true
问题是 Puma 正在以 200 状态提供零字节长度的 application.css 和 application.js,即使我仔细检查了这些文件是否存在并且已正确编译。
完整的配置/环境/production.rb:
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore …Run Code Online (Sandbox Code Playgroud)