Incompatible with gems that call `attribute` in Rails models
@KaanOzkan ci sta già lavorando.
Dal 6/12/2024.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
I'm not sure if this is an issue with tapioca or with the downstream gem, but figured I'd report here and you can tell me to go away if necessary :)
To replicate:
rails new tapioca-bug- Add
gem "noticed", "2.4.1"to Gemfile - Add
gem 'tapioca', require: falseto Gemfile bundle exec tapioca init
It will raise like this:
/.rvm/gems/ruby-3.2.2/gems/activerecord-7.2.1/lib/active_record/connection_adapters/abstract/connection_handler.rb:224:in `retrieve_connection_pool': No connection pool for 'ActiveRecord::Base' found. (ActiveRecord::ConnectionNotEstablished)
from /.rvm/gems/ruby-3.2.2/gems/activerecord-7.2.1/lib/active_record/connection_handling.rb:329:in `connection_pool'
from /.rvm/gems/ruby-3.2.2/gems/activerecord-7.2.1/lib/active_record/connection_handling.rb:321:in `connection_db_config'
from /.rvm/gems/ruby-3.2.2/gems/activerecord-7.2.1/lib/active_record/type.rb:50:in `adapter_name_from'
from /.rvm/gems/ruby-3.2.2/gems/activerecord-7.2.1/lib/active_record/attributes.rb:299:in `resolve_type_name'
from /.rvm/gems/ruby-3.2.2/gems/activemodel-7.2.1/lib/active_model/attribute_registration.rb:14:in `attribute'
from /.rvm/gems/ruby-3.2.2/gems/noticed-2.4.1/app/models/noticed/event.rb:15:in `<class:Event>'
from /.rvm/gems/ruby-3.2.2/gems/noticed-2.4.1/app/models/noticed/event.rb:2:in `<module:Noticed>'
from /.rvm/gems/ruby-3.2.2/gems/noticed-2.4.1/app/models/noticed/event.rb:1:in `<main>'
The issue is the , :json here. If you remove that, it works fine, since it doesn't need to do the type lookup anymore.
As far as I'm aware, that approach of putting models in app/models for a gem is valid, but maybe there's a more correct way to structure the gem. In any case, it works fine everywhere apart from this specific case.
The underlying issue, I think, is that Rails thinks there's no connection pool set up. This is not an issue when you boot a Rails app, it's only an issue when tapioca is eager loading.
cc @excid3
- Lingua principale
- Ruby
- Stelle
- 873
- Fork
- 164
- Merge medio
- 4g 27m
- PR unite (30g)
- 9
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Shopify/tapioca
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
Tutte le issue di Shopify/tapioca
Issue simili
-
user-reported
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Kong/developer.konghq.com#7316 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
notch8/utk_knapsack#148 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
Homebrew/homebrew-cask#288729 · 1 commento ·
-
Test `FileUtils.options_of` Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100