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

NoMethodError (undefined method `upload' for nil:NilClass):の解決法。

Posted at

AWSのS3の導入過程でで画像を投稿すると、上記のエラーが。

環境変数のキーを確認しても間違いは無かったです。

def create
    @item = Item.new(item_params)
    if @item.save   #<=ここでエラーが出ます
      redirect_to root_path
    else
      render action: :new
    end
  end

エラーが文をコピーして検索すると、同じようなエラーの記述がありました。環境変数を使えるようにするためのコマンドsource ~/.zshrcを忘れていただけでした。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?