hyperoslo / hyperoslo/activeadmin_polymorphic

Image Upload

Aperta
#17 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Ruby
Stelle
20
Fork
8
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.