app/models/effective/effective_datatable/options.rb in effective_datatables-2.1.8 vs app/models/effective/effective_datatable/options.rb in effective_datatables-2.1.9

- old
+ new

@@ -62,21 +62,23 @@ else :belongs_to end elsif has_manys.key?(name) :has_many + elsif name.include?('_address') && (collection_class.new rescue nil).respond_to?(:effective_addresses) + :effective_address elsif sql_column.try(:type).present? sql_column.type else :string # When in doubt end ) cols[name][:class] = "col-#{cols[name][:type]} col-#{name} #{cols[name][:class]}".strip - # We can't really sort a HasMany field - if cols[name][:type] == :has_many + # We can't really sort a HasMany or EffectiveAddress field + if [:has_many, :effective_address].include?(cols[name][:type]) cols[name][:sortable] = false end # EffectiveObfuscation if name == 'id' && defined?(EffectiveObfuscation) && collection.respond_to?(:deobfuscate) @@ -155,9 +157,11 @@ else Proc.new { has_many[:klass].all.map { |obj| [obj.to_s, obj.id] }.sort { |x, y| x[0] <=> y[0] } } end ) } + when :effective_address + {type: :string} when :effective_roles {type: :select, values: EffectiveRoles.roles} when :integer {type: :number} when :boolean