lib/active_admin/resource/attributes.rb in activeadmin-1.4.3 vs lib/active_admin/resource/attributes.rb in activeadmin-2.0.0.rc1
- old
+ new
@@ -16,17 +16,17 @@
resource_class.respond_to?(:reflect_on_all_associations) && foreign_methods.has_key?(c) && foreign_methods[c].name.to_sym
end
def foreign_methods
@foreign_methods ||= resource_class.reflect_on_all_associations.
- select{ |r| r.macro == :belongs_to }.
- reject{ |r| r.chain.length > 2 && !r.options[:polymorphic] }.
- index_by{ |r| r.foreign_key.to_sym }
+ select { |r| r.macro == :belongs_to }.
+ reject { |r| r.chain.length > 2 && !r.options[:polymorphic] }.
+ index_by { |r| r.foreign_key.to_sym }
end
def reject_col?(c)
- primary_col?(c) || sti_col?(c) || counter_cache_col?(c)
+ primary_col?(c) || sti_col?(c) || counter_cache_col?(c) || filtered_col?(c)
end
def primary_col?(c)
c.name == resource_class.primary_key
end
@@ -37,8 +37,11 @@
def counter_cache_col?(c)
c.name.end_with?('_count')
end
+ def filtered_col?(c)
+ ActiveAdmin.application.filter_attributes.include?(c.name.to_sym)
+ end
end
end
end