summaryrefslogtreecommitdiffstats
path: root/app/models/custom_field.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-09 22:58:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-09 22:58:30 +0000
commitb127f9157d456f233b320b349b415844eb632cb9 (patch)
tree08ce37ee7f79cc43f92beefb658577a72783d3a1 /app/models/custom_field.rb
parent877fbc15da49d4d497a1e9a0e78c589ae8632e5f (diff)
downloadredmine-b127f9157d456f233b320b349b415844eb632cb9.tar.gz
redmine-b127f9157d456f233b320b349b415844eb632cb9.zip
Resourcified custom fields.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8144 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/custom_field.rb')
-rw-r--r--app/models/custom_field.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 0ad8b4ce0..93e662785 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -155,6 +155,22 @@ class CustomField < ActiveRecord::Base
find(:all, :conditions => ["is_for_all=?", true], :order => 'position')
end
+ # Returns an instance of the given subclass name
+ def self.new_subclass_instance(class_name, *args)
+ klass = nil
+ begin
+ klass = class_name.to_s.classify.constantize
+ rescue
+ # invalid class name
+ end
+ unless subclasses.include? klass
+ klass = nil
+ end
+ if klass
+ klass.new(*args)
+ end
+ end
+
def type_name
nil
end