NoMethodError (undefined method `upload' for nil:NilClass):の解決法。
AWSのS3の導入過程でで画像を投稿すると、上記のエラーが。
環境変数のキーを確認しても間違いは無かったです。
def create
@item = Item.new(item_params)
if @item.save #<=ここでエラーが出ます
redirect_to root_path
else
render action: :new
end
end
エラーが文をコピーして検索すると、同じようなエラーの記述がありました。環境変数を使えるようにするためのコマンドsource ~/.zshrcを忘れていただけでした。
Author And Source
この問題について(NoMethodError (undefined method `upload' for nil:NilClass):の解決法。), 我々は、より多くの情報をここで見つけました https://qiita.com/yun02850266/items/d5c7d865b65a350db30c著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .