Skip to content

Commit 7beeb5c

Browse files
Make react_on_rails_pro? actively validate license and remove backward compatibility
1 parent b11a3d9 commit 7beeb5c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/react_on_rails/utils.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,18 @@ def self.gem_available?(name)
229229
end
230230

231231
# Checks if React on Rails Pro is installed and licensed.
232-
# With startup validation enabled, if this returns true, it means:
233-
# 1. The react_on_rails_pro gem is installed
234-
# 2. The license is valid (or the app would have failed to start)
232+
# This method validates the license and will raise an exception if invalid.
235233
#
236234
# @return [Boolean] true if Pro is available with valid license
235+
# @raise [ReactOnRailsPro::Error] if license is invalid
237236
def self.react_on_rails_pro?
238237
return @react_on_rails_pro if defined?(@react_on_rails_pro)
239238

240-
@react_on_rails_pro = gem_available?("react_on_rails_pro")
239+
@react_on_rails_pro = begin
240+
return false unless gem_available?("react_on_rails_pro")
241+
242+
ReactOnRailsPro::Utils.licence_valid?
243+
end
241244
end
242245

243246
# Return an empty string if React on Rails Pro is not installed

0 commit comments

Comments
 (0)