Sha256: c2876bdbfab8c79f80a6585e23681c830b537f97f5579f9de31c62b24fea3e92

Contents?: true

Size: 964 Bytes

Versions: 7

Compression:

Stored size: 964 Bytes

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
#
# Override SchemaDumper so that it ignores custom fields when generating db/schema.rb
#
require 'active_record'

unless ENV['INCLUDE_CUSTOM_FIELDS']
  module ActiveRecord
    SchemaDumper.class_eval do
      def initialize_with_ignored_custom_fields(connection, options = {})
        # Override :columns method on this connection, to ignore any custom field columns
        connection.class_eval do
          def columns(*args)
            super.reject { |c| c.name.start_with? "cf_" }
          end
        end
        initialize_without_ignored_custom_fields(connection, options)
      end

      alias_method_chain :initialize, :ignored_custom_fields
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.14.1 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.15.0.beta.2 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.15.0.beta lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.14.0 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
reduced_fat_crm-0.15.0.beta lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
reduced_fat_crm-0.14.0 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb