Skip to content

Commit

Permalink
Use addressable to replace URI.parse + add fragment to rails context
Browse files Browse the repository at this point in the history
  • Loading branch information
lucke84 committed Apr 26, 2016
1 parent 133c9fb commit 332081e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/helpers/react_on_rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ def initialize_redux_stores
# second parameter passed to both component and store generator functions.
def rails_context(server_side:)
@rails_context ||= begin
uri = URI.parse(request.original_url)
# uri = URI("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")
uri = Addressable::URI.parse(request.original_url)
# uri = Addressable::URI.parse("http://foo.com:3000/posts?id=30&limit=5#time=1305298413")

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

# Locale settings
i18nLocale: I18n.locale,
Expand Down

0 comments on commit 332081e

Please sign in to comment.