summaryrefslogtreecommitdiffstats
path: root/lib/plugins/acts_as_customizable
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-22 17:37:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-10-22 17:37:16 +0000
commit2d1866d966d94c688f9cb87c5bf3f096dffac844 (patch)
tree7a733c1cc51448ab69b3f892285305dbfb0ae15e /lib/plugins/acts_as_customizable
parenta6ec78a4dc658e3517ed682792016b6530458696 (diff)
downloadredmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.tar.gz
redmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.zip
Merged rails-4.1 branch (#14534).
git-svn-id: http://svn.redmine.org/redmine/trunk@13482 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/plugins/acts_as_customizable')
-rw-r--r--lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb b/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb
index 928e98872..f4a8b2b51 100644
--- a/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb
+++ b/lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb
@@ -27,9 +27,8 @@ module Redmine
return if self.included_modules.include?(Redmine::Acts::Customizable::InstanceMethods)
cattr_accessor :customizable_options
self.customizable_options = options
- has_many :custom_values, :as => :customized,
- :include => :custom_field,
- :order => "#{CustomField.table_name}.position",
+ has_many :custom_values, lambda {includes(:custom_field).order("#{CustomField.table_name}.position")},
+ :as => :customized,
:dependent => :delete_all,
:validate => false
@@ -46,7 +45,7 @@ module Redmine
end
def available_custom_fields
- CustomField.where("type = '#{self.class.name}CustomField'").sorted.all
+ CustomField.where("type = '#{self.class.name}CustomField'").sorted.to_a
end
# Sets the values of the object's custom fields