Sha256: 1afdf2de77cc494580de45035cf29d5bac052bf7f2bcd6ab326c0ffbd00f9746

Contents?: true

Size: 941 Bytes

Versions: 11

Compression:

Stored size: 941 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)
        # 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)
      end

      alias_method_chain :initialize, :ignored_custom_fields
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.13.5 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.13.4 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.13.3 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.13.2 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.12.3 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.12.2 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.13.1 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.12.1 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.13.0 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb
fat_free_crm-0.12.0 lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb