Skip to content

Commit

Permalink
Merge pull request railsadminteam#1259 from jcoleman/ignore-postgres-…
Browse files Browse the repository at this point in the history
…array-columns

Don't generate fields for postgresql's array columns.
  • Loading branch information
sferik committed Jul 24, 2012
2 parents 37e927c + 6c7d46d commit 043f96b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rails_admin/adapters/active_record.rb
Expand Up @@ -5,6 +5,7 @@ module RailsAdmin
module Adapters
module ActiveRecord
DISABLED_COLUMN_TYPES = [:tsvector, :blob, :binary, :spatial, :hstore]
DISABLED_COLUMN_MATCHERS = [/_array$/]

def ar_adapter
Rails.configuration.database_configuration[Rails.env]['adapter']
Expand Down Expand Up @@ -80,7 +81,9 @@ def associations
end

def properties
columns = model.columns.reject {|c| c.type.blank? || DISABLED_COLUMN_TYPES.include?(c.type.to_sym) }
columns = model.columns.reject do |c|
c.type.blank? || DISABLED_COLUMN_TYPES.include?(c.type.to_sym) || DISABLED_COLUMN_MATCHERS.any? {|matcher| matcher.match(c.type)}
end
columns.map do |property|
{
:name => property.name.to_sym,
Expand Down

0 comments on commit 043f96b

Please sign in to comment.