Skip to content

Commit

Permalink
Fix method redefinition and circular require issues (#1027)
Browse files Browse the repository at this point in the history
Closes #999

This PR addresses two issues:

Method Redefinition: The user_parameter method was being defined multiple times
in lib/clearance/configuration.rb. This has been fixed by changing attr_accessor
to attr_writer, ensuring the method is defined only once.

Circular Require: Circular dependencies between lib/clearance.rb and
lib/clearance/engine.rb have been resolved by rearranging the require statements
to avoid circular loading.
  • Loading branch information
kholdrex committed Jun 28, 2024
1 parent 8af6ec0 commit 1df5cf8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/clearance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
require 'clearance/back_door'
require 'clearance/controller'
require 'clearance/user'
require 'clearance/engine'
require 'clearance/password_strategies'
require 'clearance/constraints'
require 'clearance/engine'

module Clearance
end
2 changes: 1 addition & 1 deletion lib/clearance/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Configuration
# The parameter for user routes. By default this is derived from the user
# model.
# @return [Symbol]
attr_accessor :user_parameter
attr_writer :user_parameter

# Controls wether users are automatically signed in after successfully
# resetting their password.
Expand Down
1 change: 0 additions & 1 deletion lib/clearance/engine.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "clearance"
require "rails/engine"

module Clearance
Expand Down

0 comments on commit 1df5cf8

Please sign in to comment.