summaryrefslogtreecommitdiffstats
path: root/app/models/custom_field.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-12 17:23:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-12 17:23:14 +0000
commit5944696b6d4307de0166ba74c514aae25779abb9 (patch)
treec2543b32f0319c9e87efa7074d378e86bd60af78 /app/models/custom_field.rb
parenta727f0d25a1e9f23be869a1dc413485b43a16935 (diff)
downloadredmine-5944696b6d4307de0166ba74c514aae25779abb9.tar.gz
redmine-5944696b6d4307de0166ba74c514aae25779abb9.zip
Custom fields can now be reordered.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@901 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/custom_field.rb')
-rw-r--r--app/models/custom_field.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 81c8aae06..c3b5f2a9f 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -17,6 +17,7 @@
class CustomField < ActiveRecord::Base
has_many :custom_values, :dependent => :delete_all
+ acts_as_list :scope => 'type = \'#{self.class}\''
serialize :possible_values
FIELD_FORMATS = { "string" => { :name => :label_string, :order => 1 },
@@ -51,6 +52,10 @@ class CustomField < ActiveRecord::Base
end
end
+ def <=>(field)
+ position <=> field.position
+ end
+
# to move in project_custom_field
def self.for_all
find(:all, :conditions => ["is_for_all=?", true])