0

I'm trying to get cropping working with Paperclip and have been following along Ryan Bates' solution here.

It works fine until I submit the form and receive a mass-assignment error Can't mass-assign protected attributes: crop_x, crop_y, crop_w, crop_h.

I thought attr_accessor handled this for virtual attributes?

Taking a step back, I'm not sure if this is the best overall solution. What I want to do is actually crop the image and then save it, rather than update it after, but I'm not sure if Paperclip can handle this, since it appears it needs to handle an instance of Paperclip to perform the cropping?

Thanks.

Here is a gist of my model, controller and crop.html.erb view.

https://gist.github.com/2945549

ralphos
  • 626
  • 2
  • 10
  • 20

1 Answers1

0

attr_accessor :some_attribute just creates methods some_attribute and some_attribute= for your objects of this class.

attr_accessible manages the whitelist for mass assignment.

Sammy Larbi
  • 3,062
  • 3
  • 26
  • 21