diff --git a/lib/generators/mercury/install/images/templates/ar_paperclip_image.rb.erb b/lib/generators/mercury/install/images/templates/ar_paperclip_image.rb.erb index a23d15f90..7cd34741f 100644 --- a/lib/generators/mercury/install/images/templates/ar_paperclip_image.rb.erb +++ b/lib/generators/mercury/install/images/templates/ar_paperclip_image.rb.erb @@ -9,6 +9,8 @@ class Mercury::Image < ActiveRecord::Base :path => ":rails_root/public/system/:attachment/:id/:style/:filename", :url => "/system/:attachment/:id/:style/:filename" + validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/ + delegate :url, :to => :image def serializable_hash(options = nil) diff --git a/lib/generators/mercury/install/images/templates/mongoid_paperclip_image.rb b/lib/generators/mercury/install/images/templates/mongoid_paperclip_image.rb index 9840d8721..ba6d39dde 100644 --- a/lib/generators/mercury/install/images/templates/mongoid_paperclip_image.rb +++ b/lib/generators/mercury/install/images/templates/mongoid_paperclip_image.rb @@ -3,9 +3,11 @@ class Mercury::Image include Mongoid::Paperclip has_mongoid_attached_file :image + validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/ validates_presence_of :image + delegate :url, :to => :image def serializable_hash(options = nil)