summaryrefslogtreecommitdiffstats
path: root/lib/redmine/plugin.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/redmine/plugin.rb')
-rw-r--r--lib/redmine/plugin.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb
index c750c492d..17a20f5a8 100644
--- a/lib/redmine/plugin.rb
+++ b/lib/redmine/plugin.rb
@@ -428,6 +428,18 @@ module Redmine
Redmine::WikiFormatting.register(name, *args)
end
+ # Register plugin models that use acts_as_attachable.
+ #
+ # Example:
+ # attachment_object_type SomeAttachableModel
+ #
+ # This is necessary for the core attachments controller routes and attachments/_form to work.
+ def attachment_object_type(*args)
+ args.each do |klass|
+ Redmine::Acts::Attachable::ObjectTypeConstraint.register_object_type(klass.name.underscore.pluralize)
+ end
+ end
+
# Returns +true+ if the plugin can be configured.
def configurable?
settings && settings.is_a?(Hash) && settings[:partial].present?