Adds :inverse_of option.

git-svn-id: http://svn.redmine.org/redmine/trunk@13666 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-11-29 13:52:29 +00:00
parent 288c014aa7
commit 05262d2c34

View File

@@ -31,7 +31,7 @@ module Redmine
attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
has_many :attachments, lambda {order("#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC")}, has_many :attachments, lambda {order("#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC")},
options.merge(:as => :container, :dependent => :destroy) options.merge(:as => :container, :dependent => :destroy, :inverse_of => :container)
send :include, Redmine::Acts::Attachable::InstanceMethods send :include, Redmine::Acts::Attachable::InstanceMethods
before_save :attach_saved_attachments before_save :attach_saved_attachments
end end