0
私のRails 4.2アプリケーションでは、ui_layout
フィールドはdbテーブルのjson
に変換されます(psqlはjsonデータタイプをサポートしています)。 ui_layout
は、以前はtext
フィールドでした。 dbテーブルにjson
にui_layout
を変換した後、入力フォームnew
のレンダリングは、以下のようにエラーを返す:new
入力フォームでRails 4.2:jsonフィールドの入力フォームでのエラー
ActionView::Template::Error (No input found for json):
48: <%= f.input :footer, :label => ('Footer') %>
49: <%= f.input :time_periods, :label => ('Time Periods') %>
50: <%= f.input :max_time_period, :label => ('max Time Period') %>
51: <%= f.input :ui_layout, :label => ('UI Layout (json)'), :input_html => {:rows => 2} %>
52:
53:
54: <div class="btn-toolbar" >
simple_form (3.1.1) lib/simple_form/form_builder.rb:574:in `find_mapping'
simple_form (3.1.1) lib/simple_form/form_builder.rb:503:in `find_input'
simple_form (3.1.1) lib/simple_form/form_builder.rb:113:in `input'
/home/ubuntu/.rvm/gems/ruby-2.1.2/bundler/gems/onboard_data_uploadx-f2c20c94f7d6/app/views/onboard_data_uploadx/dashboard_details/_form_new.html.erb:51:in `block in __home_ubuntu__rvm_gems_ruby_______bundler_gems_onboard_data_uploadx_f_c__c__f_d__app_views_onboard_data_uploadx_dashboard_details__form_new_html_erb__2939072899287253628_79696400'
actionview (4.2.0) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionview (4.2.0) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
をui_layout
がtext
フィールドとして扱われます。 json
フィールドに入力する正しい方法は何ですか?テキスト入力を取ってコントローラのjson
に変換する必要がありますか?どうもありがとう。