Skip to content
Browse files

Fix custom_field_path for been usable on new instances of chiliproject

  • Loading branch information...
1 parent f7352fc commit af4d46176b1512487298f8f83b8e0eda5f8c5981 fjuan committed Nov 18, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/redmine_project_filtering/patches/custom_field_patch.rb
View
6 lib/redmine_project_filtering/patches/custom_field_patch.rb
@@ -9,8 +9,10 @@ def self.included(base) # :nodoc:
base.class_eval do
unloadable
named_scope( :used_for_project_filtering, lambda do |*args|
- used_field_setting = Setting['plugin_redmine_project_filtering']['used_fields'] || {}
- used_fields = used_field_setting.keys.collect(&:to_i)
+ plugin_settings = Setting['plugin_redmine_project_filtering']
+ used_field_setting = Setting['plugin_redmine_project_filtering'].present? ? plugin_settings['used_fields'] : {}
+ used_field_hash = used_field_setting.class == Hash ? used_field_setting : {}
+ used_fields = used_field_hash.keys.collect(&:to_i)
{ :conditions => [ "custom_fields.type = 'ProjectCustomField'
AND custom_fields.field_format = 'list'
AND custom_fields.id IN (?)", used_fields ] }

0 comments on commit af4d461

Please sign in to comment.
Something went wrong with that request. Please try again.