LoginSignup
0
0

More than 3 years have passed since last update.

【解決策】formにカラムが設定されない!?

Last updated at Posted at 2020-01-23

Webアプリを開発していて、routesとcontroller、viewを何度も見直したのにformを検証で見てみると何故かカラムが設定されない時に以下の方法で解決しました。

before

  = form_with model: @message, url: job_messages_path(@job), local: true do |f|
    = f.text_field :text

after

  = form_with model: @message, url: job_messages_path(@job), local: true do |f|
    = f.text_field :text, name: "message[text]"

下の行に、name:"テーブル名[カラム名]"を書き足せばカラムが設定され、値を入れることができました!!

0
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
0
0