1
0

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

Railsで ActiveModel::MissingAttributeError (can't write unknown attribute 〇〇)

Posted at

備忘録です
間違っていたら教えてください

ActiveModel::MissingAttributeError (can't write unknown attribute `image`):

imageカラムが書き込めないエラー

###原因 
フォームに対する型が違う?

マイグレーションファイル

t.string :image

フォーム入力画面

<%= f.file_field :image, class: 'input-box_image_file',value: "#{@tweet.image}"%>

###修正

型を変更してみる

t.text :image

これでエラー解決しました!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?