Skip to content

Commit 332081e

Browse files
committed
Use addressable to replace URI.parse + add fragment to rails context
1 parent 133c9fb commit 332081e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/helpers/react_on_rails_helper.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ def initialize_redux_stores
338338
# second parameter passed to both component and store generator functions.
339339
def rails_context(server_side:)
340340
@rails_context ||= begin
341-
uri = URI.parse(request.original_url)
342-
# uri = URI("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")
341+
uri = Addressable::URI.parse(request.original_url)
342+
# uri = Addressable::URI.parse("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")
343343

344344
result = {
345345
# URL settings
@@ -350,6 +350,7 @@ def rails_context(server_side:)
350350
port: uri.port,
351351
pathname: uri.path, # /posts
352352
search: uri.query, # id=30&limit=5
353+
fragment: uri.fragment, # time=1305298413
353354

354355
# Locale settings
355356
i18nLocale: I18n.locale,

0 commit comments

Comments
 (0)