4
3

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 5 years have passed since last update.

YAMLにyes: "はい"って書いたら表示がYesになってしまった

Last updated at Posted at 2015-03-27

「はい」「いいえ」ボタンを作ろうと思ってymlを書いたけど、viewの表示はなぜか「Yes」「No」ボタン・・・

yes: "はい"
no: "いいえ"

調べてみたら、予約語があるみたい。
で、予約語は「'」で括ることで使えるんだって。

'yes': "はい"
'no': "いいえ"

無事解決!

詳しく教えてもらったので追記
http://magazine.rubyist.net/?0009-YAML#l8
ここに書かれているルールが適用されるみたい。

んで、さっきの記述は

true: "はい"

って書いてるのと同じってことになるので、
それでymlに見つからなかったから「t('yes')」って書いたのが「Yes」って判定されたってことみたいです!

参考サイト

4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?