From 555efeacfb8e13e307489bff774487f142de535e Mon Sep 17 00:00:00 2001 From: HuBandiT Date: Mon, 17 Aug 2015 21:17:00 +0200 Subject: [PATCH] make :style of file model accessible for mass-assignment --- lib/paperclip/storage/database.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/paperclip/storage/database.rb b/lib/paperclip/storage/database.rb index 09613dc..2791dfa 100644 --- a/lib/paperclip/storage/database.rb +++ b/lib/paperclip/storage/database.rb @@ -100,6 +100,7 @@ def setup_paperclip_file_model else @paperclip_file_model = @attachment_class.const_set(class_name, Class.new(::ActiveRecord::Base)) @paperclip_file_model.table_name = @options[:database_table] || name.to_s.pluralize + @paperclip_file_model.attr_accessible :style @paperclip_file_model.validates_uniqueness_of :style, :scope => instance.class.table_name.classify.underscore + '_id' @paperclip_file_model.scope :file_for, lambda {|style| @paperclip_file_model.where('style = ?', style) } end