Sha256: 6ddcadcecc8a8b9830593ea9af65f12abf88d40ab9c051a227125a10f8d9cda9
Contents?: true
Size: 752 Bytes
Versions: 2
Compression:
Stored size: 752 Bytes
Contents
require 'paperclip' #require 'delayed_paperclip' class Image < ActiveRecord::Base belongs_to :imageable, polymorphic: true has_attached_file :file, styles: {medium: "300x300>", thumb: "100x100"}, url: "/system/:imageable_type/:imageable_id/:id/:style/:filename" validates_attachment :file, content_type: {content_type: ["image/jpeg", "image/png", "image/gif"]} validates_attachment_size :file, :less_than => 2.megabytes #process_in_background :file, processing_image_url: 'empty_avatar.png' Paperclip.interpolates :imageable_type do |attachment, style| attachment.instance.imageable_type.try(:pluralize) end Paperclip.interpolates :imageable_id do |attachment, style| attachment.instance.imageable_id end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
introspective_grape-0.0.4 | spec/dummy/app/models/image.rb |
introspective_grape-0.0.3 | spec/dummy/app/models/image.rb |