janx / rails_admin_jcrop

Jcrop plugin for RailsAdmin, enable image cropping function on image fields.
MIT License
47 stars 63 forks source link

Does not support delete image with paperclip and rails admin #14

Closed dtt101 closed 10 years ago

dtt101 commented 10 years ago

Given the following model code that enables delete with paperclip

# delete picture
attr_accessor :delete_picture
before_validation { self.picture.clear if self.delete_picture == '1' } 

rails_admin uses this to present a delete button under the picture

if the admin code is:

  field :picture do
    jcrop_options aspectRatio: 140.00/90.0
    fit_image true
  end

the delete button is not present, though for a standard paperclip declaration:

  field :picture, :paperclip

It is.

dtt101 commented 10 years ago

Apologies - read code and this fixed it:

  field :picture do
    jcrop_options aspectRatio: 140.00/90.0
    fit_image true
    delete_method :delete_picture
  end