Skip to content

Commit 6cd5f73

Browse files
committed
Make ReflexData#version more error-proof
Sometimes when you are using a locally linked version of the JavaScript package `data["version"]` will be `nil`. The sanity check relies on this method to figure out if the version matches. But since the version is `nil` in this case the `gsub` call will fail, resulting in the whole sanity check to crash with an `undefined method `gsub' for nil:NilClass` error. This commit makes that method more error prove so that the sanity check can actually you that the version didn't match. Or if you ignored the mismatch that it can continue with the process.
1 parent cb62c08 commit 6cd5f73

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/stimulus_reflex/reflex_data.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def reflex_controller
7474
end
7575

7676
def version
77-
data["version"].gsub("-pre", ".pre")
77+
data["version"].to_s.gsub("-pre", ".pre")
7878
end
7979

8080
private

0 commit comments

Comments
 (0)