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

后端 未结 6 535
挽巷
挽巷 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:40

    I had a similar problem. Solution was changing:

    attr_accessible :title, :body, :user_id, :draft, :post_type, :image
    belongs_to :user
    mount_uploader :image_url, ImageUploader
    

    to:

    attr_accessible :title, :body, :user_id, :draft, :post_type, :image_url
    belongs_to :user
    mount_uploader :image_url, ImageUploader
    

提交回复
热议问题