Closed gencer closed 2 years ago
Hi @gencer, thanks for reporting. As a big fan of Sequel, I have every intention of supporting Rails apps that use Sequel instead of Active Record. There are already places that check whether ActiveRecord
is defined to make decisions, but honestly I didn't test it with a Sequel-only Rails app, so I might have missed some places. I'll look into this.
Hmm, your backtrace shows that the rodauth:install
generator attempted to create an Active Record migration, but it should have been skipped when Active Record is not loaded: https://github.com/janko/rodauth-rails/blob/3c97a31fbf8263166075226a089d285f8cc2ed29/lib/generators/rodauth/install_generator.rb#L29-L31
Does defined?(ActiveRecord::Base)
return a truthy value in your app?
It could be possible that some other gem is loading Active Record as a gem, so it seems safer for rodauth-rails to check whether Active Record is activated by in the Rails app by checking the existence of ActiveRecord::Railtie
constant. I'll go ahead and push the change, and we'll re-open the issue if that doesn't fix it.
I would also like to start working on better Sequel integration (migrations, Rodauth::Rails::Model
support etc).
@janko You are my hero! I saw your first reply (i was outside) and going to comment here later but you were faster than me 🥳
Tested master
branch here. Works perfectly! Thank you. For now I'll stay on master
branch but I hope we can get a new release soon 🚀
BTW, Just a question: Is there anything different in rodauth-rails
than rodauth
itself? I'll going to run Sequel migrations from rodauth
. Should this be enough for rodauth-rails
? https://github.com/jeremyevans/rodauth#label-Creating+tables
For now I'll stay on master branch but I hope we can get a new release soon 🚀
FWIW, this issue only affects the rodauth:install
generator, so as soon as you've run it you can switch back to the released version. The next version is going to be 1.0, which could take a while.
I'll going to run Sequel migrations from rodauth. Should this be enough for rodauth-rails?
Default rodauth-rails configuration changes status column values to strings (so that a seprate table is not needed), disables database authentication functions (so that you can just create tables in a single migration), and sets deadline values in Ruby (so that deadline column defaults are not needed).
For now I'll stay on master branch but I hope we can get a new release soon 🚀
FWIW, this issue only affects the
rodauth:install
generator, so as soon as you've run it you can switch back to the released version. The next version is going to be 1.0, which could take a while.
Done. Thanks for the update!
Default rodauth-rails configuration changes status column values to strings (so that a seprate table is not needed), disables database authentication functions (so that you can just create tables in a single migration), and sets deadline values in Ruby (so that deadline column defaults are not needed).
I'll look what changes made and I'll adapt to it if necessary. 👌🥳
I have an existing project that composed by these:
So I gone ahead and dumped Devise + Doorkeeper, However, I also have this setup in my
application.rb
As you can see, I am not using ActiveRecord at all. Instead i'm using
sequel-rails
to bring Sequel to the Rails...Problem starts here, I cannot execute
rodauth:install
. It hangs on ActiveRecord step and says db is unreachable. If I manually dumpActiveRecord
viaObject.send(:remove_const, :ActiveRecord)
- which is not recommended way of doing this - then I get ActiveModel issues.Basically, either one of;
a. rodauth-rails forcefully requires
ActiveRecord
b. Does not work withsequel-rails
c. Something is wrong with the existing project (still searching, tho.)Do you have any idea? Should I get rid of
sequel-rails
and use ActiveRecord as-is? But the whole project is depends on Sequel and has no any ActiveRecord-related content at all.Some logs: