我想在 Rails 应用程序中显示用户的活动提要。我正在使用 feedjira。
2.2.4 :006 > xml_feed = Feedjira::Feed.fetch_raw "https://github.com/prasadsurase.atom"
2.2.4 :006 > github_feed = Feedjira::Feed.parse xml_feed
2.2.4 :006 > github_feed.entries.first.content
=> "<!-- pull_request -->\n<svg aria-label=\"Pull request\" class=\"octicon octicon-git-pull-request dashboard-event-icon\" height=\"32\" role=\"img\" version=\"1.1\" viewBox=\"0 0 12 16\" width=\"24\"><path d=\"M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z\"></path></svg>\n\n<div class=\"time\">\n <relative-time datetime=\"2016-09-23T07:30:24Z\">Sep 23, 2016</relative-time>\n</div>\n\n<div class=\"title\">\n <a href=\"/prasadsurase\" data-ga-click=\"News feed, event click, Event click type:PullRequestEvent target:actor\">prasadsurase</a> opened pull request <a href=\"/joshsoftware/code-curiosity/pull/136\" data-ga-click=\"News feed, event click, Event click type:PullRequestEvent target:pull\">joshsoftware/code-curiosity#136</a>\n</div>\n\n<div class=\"details\">\n <a href=\"/prasadsurase\"><img alt=\"@prasadsurase\" class=\"gravatar\" height=\"30\" src=\"https://avatars3.githubusercontent.com/u/562052?v=3&s=60\" width=\"30\" /></a>\n <div class=\"message\">\n <blockquote>Fixed controller method scopes. Removed unwanted routes.</blockquote>\n <div class=\"pull-info\">\n <svg aria-hidden=\"true\" class=\"octicon octicon-git-commit\" height=\"16\" version=\"1.1\" viewBox=\"0 0 14 16\" width=\"14\"><path d=\"M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z\"></path></svg>\n <em>1</em> commit with\n <em>34</em> additions and\n <em>31</em> deletions\n </div>\n </div>\n</div>\n"
在将 haml 中 github_feed.entries 中的每个条目的内容呈现为raw时,链接不包含域https://github.com/,而仅包含路径。这会导致问题,例如 UI 上呈现的链接包含应用程序域而不是 github。我们如何解决这个问题?