I have a problem with attr_accessible
and attr_accessor
.
When I use attr_accessor in model:
attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
attr_accessible :title, :author, :description, :price, :attach
Error:
Server return:
WARNING: Can't mass-assign protected attributes for Product: crop_x, crop_y, crop_w, crop_h
I edited as follow:
attr_accessible :title, :author, :description, :price, :attach
attr_accessible :crop_x, :crop_y, :crop_w, :crop_h
Error:
Server return:
undefined method `crop_x' for #<Product:0x007fe900f88c20>
So, I used both attr_accessible
and attr_accessor
:
attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
attr_accessible :title, :author, :description, :price, :attach
attr_accessible :crop_x, :crop_y, :crop_w, :crop_h
But server run forever.