Sha256: daea63c069689b283884603644befc35b2e1d56b984c442e6962a511cc6dd3ec

Contents?: true

Size: 489 Bytes

Versions: 23

Compression:

Stored size: 489 Bytes

Contents

# Prevent `MyModel.inspect` failing with `ActiveRecord::ConnectionNotEstablished`
# (triggered by elasticsearch-model/lib/elasticsearch/model.rb:79:in `included')
#
ActiveRecord::Base.instance_eval do
  class << self
    def inspect_with_rescue
      inspect_without_rescue
    rescue ActiveRecord::ConnectionNotEstablished
      "#{self}(no database connection)"
    end

    alias_method_chain :inspect, :rescue
  end
end if defined?(ActiveRecord) && ActiveRecord::VERSION::STRING < '4'

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
elasticsearch-model-queryable-0.1.9 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-6.1.2 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-queryable-0.1.5 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-6.1.1 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-6.1.0 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-6.0.0 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-6.0.0.pre lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-5.1.0 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-5.0.2 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-2.0.1 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-5.0.1 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-2.0.0 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-5.0.0 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-0.1.9 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-0.1.8 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-0.1.7 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-0.1.6 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-0.1.5 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-0.1.4 lib/elasticsearch/model/ext/active_record.rb
elasticsearch-model-0.1.3 lib/elasticsearch/model/ext/active_record.rb