Skip to content

Commit 7f9a2d9

Browse files
committed
Address use of constantize on user-defined value by returning predefined classes
1 parent 0b22f5e commit 7f9a2d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/controllers/better_together/platform_invitations_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ def param_invitation_class
125125
param_type = params[:platform_invitation][:type]
126126

127127
Rails.application.eager_load! if Rails.env.development? # Ensure all models are loaded
128-
valid_types = [BetterTogether::PlatformInvitation, *BetterTogether::PlatformInvitation.descendants].map(&:to_s)
129-
param_type.constantize if valid_types.include?(param_type)
128+
valid_types = [BetterTogether::PlatformInvitation, *BetterTogether::PlatformInvitation.descendants]
129+
valid_types.find { |klass| klass.to_s === param_type }
130130
end
131131
end
132132
# rubocop:enable Metrics/ClassLength

0 commit comments

Comments
 (0)