kreativgebiet/rich

Rails 4.2, Formtastic 3

Opened this issue · 1 comments

Hello,

I have been playing around with getting Rich to work with Formtastic 3 and Rails 4.2

I have discovered that it mostly works, the only thing that is preventing it from working is that the Rails actionview helper that creates the field, when using paperclip, tries to use the Paperclip object instance as the value for the field. When you pass in the field value with the input_html setting everything works.

It may be good to setup some defaults to handle this situation and pass in the value of the field automatically. Here is the settings that seem to work.

 <% p.input :photo, :as => :rich_picker,
        config: {
        :hidden_input => true,
        :placeholder_image => "",
        :scoped => "image"
      },
      input_html: {
        value: p.object.photo.url
      }
      %>

Any thoughts on this, I think that it would be relatively easy to collect this value and pass it to the builder, we may just need to have adapters for each supported image uploader to make up for differences between carrierwave and paperclip.

As a side note, this is only an issue with creation forms, edit forms seem un-affected since an existing attribute is passed in as the value not an uploader instance.