Closed alexgleason closed 9 months ago
Howdy! I'm fighting to make this Gem work. And it could be my fault, because I'm a novice at Ruby on Rails.
I added the gem with bundle add nostr_ruby, and then used require "nostr_ruby" at the top of my model.
bundle add nostr_ruby
require "nostr_ruby"
But when I try to run migrations, it refuses to work. Here is the traceback. Any ideas what could be going on?
➜ bin/rails db:migrate --trace ** Invoke db:migrate (first_time) ** Invoke db:load_config (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:load_config ** Execute db:migrate bin/rails aborted! NameError: uninitialized constant Nostr (NameError) Object.const_get(camel_cased_word) ^^^^^^^^^^ Did you mean? NostrTag /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3/lib/active_support/inflector/methods.rb:290:in `const_get' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3/lib/active_support/inflector/methods.rb:290:in `constantize' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3/lib/active_support/core_ext/string/inflections.rb:74:in `constantize' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1189:in `load_migration' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1182:in `migration' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1178:in `disable_ddl_transaction' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1587:in `use_transaction?' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1534:in `rescue in execute_migration_in_transaction' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1522:in `execute_migration_in_transaction' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1503:in `each' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1503:in `migrate_without_lock' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1450:in `migrate' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1274:in `up' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1249:in `migrate' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/tasks/database_tasks.rb:243:in `migrate' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/railties/databases.rake:93:in `block (2 levels) in <main>' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `block in execute' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `each' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `execute' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:219:in `block in invoke_with_call_chain' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `synchronize' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `invoke_with_call_chain' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:188:in `invoke' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:182:in `invoke_task' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block (2 levels) in top_level' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `each' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block in top_level' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:147:in `run_with_threads' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:132:in `top_level' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:27:in `block (2 levels) in perform' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:208:in `standard_exception_handling' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:27:in `block in perform' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:44:in `block in with_rake' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/rake_module.rb:59:in `with_application' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:41:in `with_rake' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:20:in `perform' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:156:in `invoke_rake' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:73:in `block in invoke' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:149:in `with_argv' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:69:in `invoke' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands.rb:18:in `<main>' <internal:/home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require' <internal:/home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `<main>' Caused by: NameError: uninitialized constant Nostr (NameError) Object.const_get(camel_cased_word) ^^^^^^^^^^ Did you mean? NostrTag /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3/lib/active_support/inflector/methods.rb:290:in `const_get' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3/lib/active_support/inflector/methods.rb:290:in `constantize' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.3/lib/active_support/core_ext/string/inflections.rb:74:in `constantize' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1189:in `load_migration' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1182:in `migration' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1178:in `disable_ddl_transaction' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1587:in `use_transaction?' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1579:in `ddl_transaction' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1528:in `execute_migration_in_transaction' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1503:in `each' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1503:in `migrate_without_lock' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1450:in `migrate' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1274:in `up' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/migration.rb:1249:in `migrate' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/tasks/database_tasks.rb:243:in `migrate' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.3/lib/active_record/railties/databases.rake:93:in `block (2 levels) in <main>' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `block in execute' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `each' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:281:in `execute' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:219:in `block in invoke_with_call_chain' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `synchronize' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:199:in `invoke_with_call_chain' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/task.rb:188:in `invoke' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:182:in `invoke_task' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block (2 levels) in top_level' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `each' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:138:in `block in top_level' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:147:in `run_with_threads' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:132:in `top_level' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:27:in `block (2 levels) in perform' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/application.rb:208:in `standard_exception_handling' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:27:in `block in perform' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:44:in `block in with_rake' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.1.0/lib/rake/rake_module.rb:59:in `with_application' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:41:in `with_rake' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands/rake/rake_command.rb:20:in `perform' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:156:in `invoke_rake' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:73:in `block in invoke' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:149:in `with_argv' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/command.rb:69:in `invoke' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.3/lib/rails/commands.rb:18:in `<main>' <internal:/home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require' <internal:/home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require' /home/alex/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require' bin/rails:4:in `<main>' Tasks: TOP => db:migrate
It was the filename of my migration! Nothing to do with this library 🤦
Howdy! I'm fighting to make this Gem work. And it could be my fault, because I'm a novice at Ruby on Rails.
I added the gem with
bundle add nostr_ruby
, and then usedrequire "nostr_ruby"
at the top of my model.But when I try to run migrations, it refuses to work. Here is the traceback. Any ideas what could be going on?