Giter Club home page Giter Club logo

Comments (16)

jodosha avatar jodosha commented on June 2, 2024 4

Ruby 2.7.0 removed BigDecimal.new, so we need to monkey-patch BigDecimal 😢 .

from model.

cllns avatar cllns commented on June 2, 2024 4

@CryptoRodeo Yea, putting gem 'bigdecimal', '~> 1.4' (or 1.3, if you don't want warnings) in your Gemfile fixes this for now. We'll figure out a better solution of course, but this will get you unblocked :)

Note, you may also have to do OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES bundle exec hanami server if you're seeing an EOFError

from model.

dudo avatar dudo commented on June 2, 2024 4

Seems as though closing this was a bit premature, no? locking the version of bigdecimal is a bandaid. Any plans to fix the root cause?

from model.

nomanurrehman avatar nomanurrehman commented on June 2, 2024 3

I am still getting this error with the latest stable release. Do I still need to patch it in the Gemfile as mentioned above?

from model.

CryptoRodeo avatar CryptoRodeo commented on June 2, 2024 1

@cllns @jodosha Thanks for the help!

from model.

adam12 avatar adam12 commented on June 2, 2024 1

locking the version of bigdecimal is a bandaid. Any plans to fix the root cause?

I looked at this back in December and the changes are possible but might not be worth it.

The dependency on sequel that our rom-sql dependency has needs to be relaxed to allow sequel 5.x, but there are breaking changes that require other changes to rom-sql (I have a branch here that I was working on, which you can see some of the changes).

Updating both rom-sql and sequel still has many Ruby 2.7 warnings. The upgrade of sequel may cause unexpected bugs with what rom-sql expects. That lineage of rom-sql is essentially out of maintenance, and @solnic agreed to a maintenance release to get this moving, but supporting an ancient version is not planned.

Upgrading hanami-model to support newer versions of ROM might be wasted when work could be better done to just suggest / help strategize on how to move to ROM directly for Hanami 1 users, or further progress on Hanami 2.

from model.

cllns avatar cllns commented on June 2, 2024

Hi there, thanks for reporting this and sorry you're having trouble.

Can you post the full stack trace of the error, if there is one? And let us know which version of Ruby you're using. If you could upload the project as a repo on GitHub, that'd be swell too :)

from model.

CryptoRodeo avatar CryptoRodeo commented on June 2, 2024

Thanks for responding!

Here is the repo: https://github.com/CryptoRodeo/hanami_project

I'm using ruby 2.7.0

Here is the stack trace i get whenever i run the server:

**Boot Error**
Something went wrong while loading /home/bryan/Documents/projects/hanami_project/bookshelf/config.ru

**Hanami::Model::Error: undefined method `new' for class `#<Class:BigDecimal>' Did you mean? next**
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-model-1.3.2/lib/hanami/model/configuration.rb:161:in `rescue in load!'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-model-1.3.2/lib/hanami/model/configuration.rb:150:in `load!'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-model-1.3.2/lib/hanami/model.rb:80:in `load!'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components/components.rb:89:in `block (2 levels) in <module:Components>'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components/component.rb:44:in `call'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:108:in `block (2 levels) in resolve'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.5/lib/concurrent/map.rb:193:in `block in fetch_or_store'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.5/lib/concurrent/map.rb:172:in `fetch'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.5/lib/concurrent/map.rb:192:in `fetch_or_store'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:106:in `block in resolve'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:105:in `each'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:105:in `resolve'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components/component.rb:144:in `resolve_requirements'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components/component.rb:36:in `call'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:108:in `block (2 levels) in resolve'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.5/lib/concurrent/map.rb:193:in `block in fetch_or_store'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.5/lib/concurrent/map.rb:172:in `fetch'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.5/lib/concurrent/map.rb:192:in `fetch_or_store'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:106:in `block in resolve'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:105:in `each'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/components.rb:105:in `resolve'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami.rb:126:in `boot'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami.rb:151:in `app'
/home/bryan/Documents/projects/hanami_project/bookshelf/config.ru:3:in `block in inner_app'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.1.2/lib/rack/builder.rb:71:in `instance_eval'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.1.2/lib/rack/builder.rb:71:in `initialize'
/home/bryan/Documents/projects/hanami_project/bookshelf/config.ru:1:in `new'
/home/bryan/Documents/projects/hanami_project/bookshelf/config.ru:1:in `inner_app'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:113:in `eval'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:113:in `inner_app'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:103:in `assemble_app'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:86:in `proceed_as_child'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:31:in `call!'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/shotgun-0.9.2/lib/shotgun/loader.rb:18:in `call'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/hanami-1.3.3/lib/hanami/assets/static.rb:49:in `call'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.1.2/lib/rack/lint.rb:51:in `_call'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.1.2/lib/rack/lint.rb:39:in `call'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.1.2/lib/rack/show_exceptions.rb:25:in `call'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/rack-2.1.2/lib/rack/handler/webrick.rb:88:in `service'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/2.7.0/webrick/httpserver.rb:140:in `service'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/2.7.0/webrick/httpserver.rb:96:in `run'
/home/bryan/.rbenv/versions/2.7.0/lib/ruby/2.7.0/webrick/server.rb:307:in `block in start_thread'``

from model.

cllns avatar cllns commented on June 2, 2024

@jodosha Could we specify using BigDecimal v1.x? It seems like v2.0 is causing this
https://github.com/ruby/bigdecimal#which-version-should-you-select

Or, we could convert calls of BigDecimal.new() to just BigDecimal(), assuming they behave the same way.
https://ruby-doc.org/stdlib-2.7.0/libdoc/bigdecimal/rdoc/Kernel.html#method-i-BigDecimal

from model.

cllns avatar cllns commented on June 2, 2024

Going to re-open this Issue so we can keep track of it and fix it properly 🌸

from model.

jodosha avatar jodosha commented on June 2, 2024

@cllns yeah BigDecimal.new() to just BigDecimal() is worth a try. 👍

from model.

tadejm avatar tadejm commented on June 2, 2024

We're depending on the oj gem for JSON generation/parsing and they've recently added bigdecimal as a runtime dependency, ohler55/oj#617 which conflicts with hanami-model 1.3.2.

A quick way to get around this is to point to latest hanami-model master which contains @cllns's fix:

# Gemfile
-gem "hanami-model", require: false
+gem "hanami-model", git: "https://github.com/hanami/model.git", require: false

Any plans on releasing 1.3.3 with this patch?

EDIT:

Actually, NVM the above:
https://github.com/ohler55/oj/blob/develop/CHANGELOG.md#31013---2020-08-28

from model.

nomanurrehman avatar nomanurrehman commented on June 2, 2024

Adding the Gemfile fix above solves it for me.

from model.

dudo avatar dudo commented on June 2, 2024

Where we at with 1.3.3, folks?

from model.

adam12 avatar adam12 commented on June 2, 2024

Where we at with 1.3.3, folks?

Is master working for you? or are you using a different solution?

I'm not super keen on the bigdecimal dependency; I'd almost rather a monkeypatch for BigDecimal.new in this case.

from model.

cllns avatar cllns commented on June 2, 2024

For reference, hanami-model v1.3.3 was released on May 22, 2021. If you're having this issue, upgrade to that version and you should be good to go.

from model.

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.