Ruby on Rails 5.2.1
で作業しています。
i18n
を活用しているのですが、添付画像のと通り、初期画面で機能しているものの
サイトをリフレッシュすると、途端に機能しなくなります。原因わからずご教示戴けますと幸甚です。
ruby
1###application.rb 2 3config.i18n.default_locale = :en 4 5###model 6 STATUS_VALUES = %w(draft ready) 7 8 class << self 9 def status_text(status) 10 I18n.t("activerecord.attributes.tender.status_#{status}") 11 end 12 13 def status_options 14 STATUS_VALUES.map {|status| [status_text(status), status]} 15 end 16 end 17 18### contorller 19class Sellers::TendersController < ApplicationController 20 I18n.locale = "ja" 21 22 省略 23 24 def new 25 @tender = Tender.new 26 time0 = Time.current.beginning_of_day 27 @tender.starts_at = time0.advance(days: 1, hours: 10) 28 @tender.ends_at = time0.advance(days: 3, hours: 15) 29 end 30 31 省略 32 33end 34 35###form 36 37<%= f.label :status, "ステータス" %> 38<%= f.select :status, Tender.status_options, {}, class: 'form-control' %>
yml
1###ja.yml 2 3ja: 4 activerecord: 5 models: 6 tender: 入札 7 attributes: 8 tender: 9 status: 状態 10 status_draft: ドラフト 11 status_ready: 完了 12
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/09 12:27
2018/12/09 23:28 編集
2018/12/10 11:10