Coder Social home page Coder Social logo

Comments (7)

karmi avatar karmi commented on September 23, 2024

Yes, definitely seems like it. I'll look into it, it'll take some time, though. Couple of notes:

a) The implementation is quite isolated in support/forwardable.rb, so it should be easy to tweak it.

b) I couldn't decide whether to use ActiveSupport's delegation or not, in the end it would make more sense, I guess.

c) The implementation shouldn't trample on the delegate method in your class, that's some unfortunate side-effect of using Forwardable from Ruby's standard library, I think. That should be fixed.

from elasticsearch-rails.

zzet avatar zzet commented on September 23, 2024

Actual for me too :(

from elasticsearch-rails.

snop-snov avatar snop-snov commented on September 23, 2024

And for me

from elasticsearch-rails.

karmi avatar karmi commented on September 23, 2024

Looking into it... ripped out stdlib's Forwardable, replaced with #delegate, though there's a problem with ActiveRecord 3:

Due to inspect in https://github.com/rails/rails/blob/8dec2e7281a1b38db037dc23becd1a147d1fcae1/activesupport/lib/active_support/core_ext/module/delegation.rb#L179 I'm getting "Connection not established errors:.

gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
  from .../gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
  from .../gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
  from .../gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/model_schema.rb:224:in `table_exists?'
  from .../gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/base.rb:423:in `inspect'
  from .../gems/1.9.1/gems/activesupport-3.2.16/lib/active_support/core_ext/module/delegation.rb:137:in `to_s'
  from .../gems/1.9.1/gems/activesupport-3.2.16/lib/active_support/core_ext/module/delegation.rb:137:in `block in delegate'
  from .../gems/1.9.1/gems/activesupport-3.2.16/lib/active_support/core_ext/module/delegation.rb:125:in `each'
  from .../gems/1.9.1/gems/activesupport-3.2.16/lib/active_support/core_ext/module/delegation.rb:125:in `delegate'
  from .../elasticsearch-rails/elasticsearch-model/lib/elasticsearch/model.rb:105:in `singletonclass'
  from .../elasticsearch-rails/elasticsearch-model/lib/elasticsearch/model.rb:104:in `block in included'
  from .../elasticsearch-rails/elasticsearch-model/lib/elasticsearch/model.rb:79:in `class_eval'
  from .../elasticsearch-rails/elasticsearch-model/lib/elasticsearch/model.rb:79:in `included'

from elasticsearch-rails.

karmi avatar karmi commented on September 23, 2024

Replaced Forwardable by ActiveSupport's delegate, should be all set now.

Had to monkeypatch ActiveRecord::Base.inspect on ActiveRecord < 4 to prevent errors mentioned above.

from elasticsearch-rails.

zzet avatar zzet commented on September 23, 2024

@karmi 👍

from elasticsearch-rails.

samqiu avatar samqiu commented on September 23, 2024

Cool! @karmi

from elasticsearch-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.