Sha256: a44fd131dba9774745d48e8d8b8809411bda14254740c7180895186f355489cd

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

unless respond_to?(:tap)
  class Object
    def tap
      yield self
      self
    end
  end
end

unless respond_to?(:try)
  class Object
    def try(*a, &b)
      if a.empty? && block_given?
        yield self
      else
        __send__(*a, &b)
      end
    end
  end

  class NilClass
    def try(*args); nil; end
  end
end

class ActiveRecord::Base
  # Instantiate a new NullDB connection.  Used by ActiveRecord internally.
  def self.nulldb_connection(config)
    ActiveRecord::ConnectionAdapters::NullDBAdapter.new(config)
  end
end


module ActiveRecord
  # Just make sure you have the latest version of your schema
  superclass = ActiveRecord::VERSION::MAJOR == 5 ? Migration[5.0] : Migration
  class Schema < superclass
    def self.define(info={}, &block)
      instance_eval(&block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-nulldb-adapter-0.3.6 lib/nulldb/extensions.rb