Conversation
Without tzinfo-data, a simple: bundle install bundle exec rspec was failing with a report of it being missing. All tests pass now.
Rails doesn't seem to autodiscover the generators unless they're in `lib/<generators>/<gem_name>/<generator>/<generator>_generator.rb` After this change `./bin/rails generate --help` shows the generator as expected and running `rails generate sqlite_crypto:install` creates the initializer file as expected.
In Rails 8, the schema.rb is wrapped in: ActiveRecord::Schema[8.1].define(version: ...) do Within that context, isn't ActiveRecord::Schema as it presumably is under Rails < 7. Instead it's ActiveRecord::Schema::Definition so the helper isn't defined and so errors because is undefined. This change opportunistically patches the correct class if it's available.
|
Hey @yostinso - I’m closing this PR since I opened and released new FIX based on your discoveries, and added also integrations tests, and few things. Thanks again for reporting these - both are confirmed bugs. Here's more detailed info:
Fix PR with updated tests: #18 |
|
Thanks! I actually ran into tzinfo-data missing inside a hardened Ubuntu container, but fair point that it's environment dependent. |
|
Sure, whenever you find something else that needs fix or improvement feel free to reach out or create PR. Have a nice day! |
In trying to adopt this gem into a fresh Rails 8.1 project, I ran across a couple of bugs:
create_table "table_name", id: uuid ...becauseuuidwasn't defined. Some digging showed that at least in my version of Rails, the schema code isn't executed in the context ofActiveRecord::Schemabut instead in the context ofActiveRecord::Schema::Definition. Patching that second class (if present) let my schema tests pass.Thanks for putting together this gem; I was pretty pleased to run across a solution for UUIDs in simple Rails/Sqlite3 apps.