hyperoslo / hyperoslo/activeadmin_polymorphic

Image Upload

未关闭
#17 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Ruby
星标
20
派生
8
PR 合并指标
30 天内没有已合并 PR

描述

Hi,

I have an application with the models Section and Element with polymorphic associations to Paragraph and Image.

```
class Section < ActiveRecord::Base
has_many :elements
end
```

```
class Element < ActiveRecord::Base
belongs_to :section
belongs_to :implementation, polymorphic: true
accepts_nested_attributes_for :implementation
end
```

```
class Paragraph < ActiveRecord::Base
has_one :element, as: :implementation
end
```

```
class Image < ActiveRecord::Base
mount_uploader :file, ImageUploader
has_one :element, as: :implementation
end
```

I was able to make the Section form with the Paragraph class. However, with Image class I not able to upload files due to file fields in form are stripped out as you mentioned in the to documentation.

I have already configured carrierwave + remotipart and actually images are uploaded asynchronously from the new image form (outsite the Section form). However, but I was not able to make that work within the Section form. I have noticed that file are still stripped out only when I try to add and send a new Image from the Section form.

Do you have an example or more detailed documentation regarding image uploading?

Thanks in advance

贡献指南

这个仓库没有索引到贡献指南

调研方向

该 issue 提到了 Section、Element、Paragraph、Image、CarrierWave、Remotipart 和 Section 表单;首先在其中复现嵌套创建 Image 的过程,并将其与独立的新建 Image 表单进行比较。完成的标准是,有示例或文档说明所需的设置,并且可以从 Section 表单上传图片。

由索引模型根据 Issue 内容生成。

评估

技术栈
rails, ruby
领域
backend, documentation
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。