Rails 3 polymorphic association with Carrierwave and Simple Form

后端 未结 1 1067
半阙折子戏
半阙折子戏 2021-02-03 16:30

I\'m trying to set up a polymorphic association for photo uploads which are processed using Carrierwave. I\'m using Simple Form to build my forms. I feel like the association is

相关标签:
1条回答
  • 2021-02-03 17:01

    Since your models have_many :images (it should be :images, not :image), you'll want to use nested_forms in your views. You should set up accepts_nested_attributes_for :images on the unit and property models and change the attr_accessible from :image to :image_attributes.

    Check out http://railscasts.com/episodes/196-nested-model-form-part-1 for a good guide on getting going with it.

    0 讨论(0)
提交回复
热议问题