Comments (16)
Ruby 2.7.0 removed BigDecimal.new
, so we need to monkey-patch BigDecimal
😢 .
from model.
@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.
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.
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.
@cllns @jodosha Thanks for the help!
from model.
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.
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.
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.
@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.
Going to re-open this Issue so we can keep track of it and fix it properly 🌸
from model.
@cllns yeah BigDecimal.new()
to just BigDecimal()
is worth a try. 👍
from model.
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.
Adding the Gemfile
fix above solves it for me.
from model.
Where we at with 1.3.3, folks?
from model.
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.
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)
- Date with BC note in PostgreSQL parsed incorrectly
- Optimistic Locking HOT 2
- Repository #find_or_create_by HOT 2
- Database column defaults are not replacing empty string or nil values HOT 4
- Sqlite3 'dumps database schema.sql' test failing HOT 3
- Private method 'Array' in hanami entity HOT 2
- Extra query with assoc and that make app slow HOT 1
- Associations don't seem to work well with as: aliases. HOT 3
- What's the recommend way to use transactions? HOT 3
- NoMethodError: undefined method `one' for #<Hanami::Model::Associations::HasMany> HOT 4
- Can't prepare testing PostgreSQL database HOT 5
- #to_hash and implicit conversion HOT 4
- Error
- db prepare raises Postgres createdb error HOT 14
- Unable to control production DB log HOT 1
- [QUESTION] There is a "How to" guide for the test/development process? HOT 2
- Use original error in case role is missing for Postgres HOT 1
- Change default dataset configured in ROM HOT 1
- Outdated dependencies HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from model.