Merge pull request #23 from finnlabs/feature/rails3_fix_custom_class_generation

[OPF#1007] Changed generation of filter and group-by-classes for custom fields to n...
pull/6827/head
Christian Rijke 12 years ago
commit f635e81740
  1. 5
      app/models/cost_query/custom_field_mixin.rb

@ -26,7 +26,7 @@ module CostQuery::CustomFieldMixin
def generate_subclasses
IssueCustomField.all.map do |field|
class_name = class_name_for field.name
class_name = "CustomField#{field.id}"
parent.send(:remove_const, class_name) if parent.const_defined? class_name
parent.const_set class_name, Class.new(self)
parent.const_get(class_name).prepare(field, class_name)
@ -82,7 +82,4 @@ module CostQuery::CustomFieldMixin
super
end
def class_name_for(field)
"CustomField" << field.split(/[ \-_]/).map { |part| part.gsub(/\W/, '').capitalize }.join
end
end

Loading…
Cancel
Save