Skip to content

Commit

Permalink
Handle Sequel apps when checking primary key type
Browse files Browse the repository at this point in the history
In Rails apps that use Sequel as the primary database, generator options
for Active Record will likely be absent, so we handle that.
  • Loading branch information
janko committed Nov 20, 2023
1 parent 1d41cfb commit bd85f3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/generators/rodauth/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def argon2?
end

def primary_key_integer?
!::Rails.configuration.generators.options[:active_record][:primary_key_type]
!::Rails.configuration.generators.options.dig(:active_record, :primary_key_type)
end

def sequel_activerecord_integration?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class RodauthMain < Rodauth::Rails::Auth
db Sequel.<%= sequel_adapter %>(extensions: :activerecord_connection, keep_reference: false)
<% end -%>

# Avoid DB query that checks accounts table schema at boot time.
convert_token_id_to_integer? <%= primary_key_integer? %>

<% end -%>
Expand Down

0 comments on commit bd85f3a

Please sign in to comment.