Rails + CarrierWave: NoMethodError: undefined method `name' for nil:NilClass

后端 未结 6 516
挽巷
挽巷 2021-01-18 02:19

I am using CarrierWave with Rails 3.1. I am getting the following error message when I submit the form (trying to upload an image):

Error Message:

Ac         


        
6条回答
  •  离开以前
    2021-01-18 02:36

    Make sure you use - mount_uploader :image, ImageUploader in your model like here -

    class CarImage < ActiveRecord::Base 
      belongs_to :car
      mount_uploader :image, ImageUploader
    end
    

    Regards

    Robbie

提交回复
热议问题