Add image to product

This commit is contained in:
2014-08-27 17:14:56 +02:00
parent 22ebf9e376
commit 2ed16351da
15 changed files with 55 additions and 23 deletions
+12
View File
@@ -1,6 +1,7 @@
class Product
include SimplyStored::Couch
include ActiveModel::SerializerSupport
include Paperclip::Glue
property :name
property :code
@@ -26,6 +27,17 @@ class Product
is_dirty
end
property :image_file_name
property :image_content_type
property :image_file_size, :type => Fixnum
property :image_updated_at, :type => Time
has_attached_file :image,
url: '/system/product/:id/images/:style.:extension',
styles: {medium: '512x512>', thumb: '128x128>', large: '896x896>', small: '320x320>'},
default_url: '/assets/user/blank-pixel.png'
validates_attachment :image, content_type: {content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"]}
private
def persist_product_category_ids