8
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

`content_for` で数値が表示されてなかった

Last updated at Posted at 2023-03-13

最近 slim ちゃんと使ってないな

と苦手意識を持ってやっていたらハマった.
ちなみに Rails は 6.1 です.

eval error: invalid codepoint 0xXXXX in UTF-8

初めは何かわからなかったけど,絞り込んだら,
content_for 辺りに何かありそう.

irb> content_for(:var1, 55500)
eval error: invalid codepoint 0xD8CC in UTF-8

ということで,7.0 で修正された内容が関係ありそう.
とりあえず,自分で,.to_s するか.

irb> content_for(:var1, 55500.to_s)
nil
irb> yield(:var1)
"55500"

まとめ

  • ちゃんとエラーが出てくれてありがたい

Refs

8
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?