LoginSignup
14
17

More than 3 years have passed since last update.

form_forのf.date_select実装時のエラー undefined method `map' for "translation missing: ja.date.order":String

Last updated at Posted at 2019-10-04

undefined method `map' for "translation missing: ja.date.order":String

form_forにてf.date_selectを実装しようとした時のエラー

rails 5.2.3
ruby 2.5

birthdayカラムはdate型

調べるとrails4で良く起きているらしい。rails5なのに。。。。

とりあえず。。。

解決方法

config>locales>ja.ymlを作成

ja.yml
ja:
  date:
    formats:
      default: "%Y/%m/%d"
      short: "%m/%d"
      long: "%Y年%m月%d日(%a)"

    day_names: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日]
    abbr_day_names: [, , , , , , ]

    month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
    abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]

    order:
      - :year
      - :month
      - :day

  time:
    formats:
      default: "%Y/%m/%d %H:%M:%S"
      short: "%y/%m/%d %H:%M"
      long: "%Y年%m月%d日(%a) %H時%M分%S秒 %Z"
    am: "午前"
    pm: "午後"

を追記とりあえず解決

14
17
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
14
17