Sha256: 4ca66e8122619e1ea2b93e0c20aab62e29dabd03fa627d1769c2ecd7a23f4961

Contents?: true

Size: 403 Bytes

Versions: 4

Compression:

Stored size: 403 Bytes

Contents

module NilifyBlanks
  if defined?(Rails::Railtie)
    require "rails"
    
    class Railtie < Rails::Railtie
      initializer "nilify_blanks.extend_active_record" do
        ActiveSupport.on_load(:active_record) do
          NilifyBlanks::Railtie.insert
        end
      end
    end
  end
  
  class Railtie
    def self.insert
      ActiveRecord::Base.send(:include, NilifyBlanks)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nilify_blanks-1.3.0 lib/nilify_blanks/railtie.rb
nilify_blanks-1.2.1 lib/nilify_blanks/railtie.rb
nilify_blanks-1.2.0 lib/nilify_blanks/railtie.rb
nilify_blanks-1.1.0 lib/nilify_blanks/railtie.rb