]> git.openstreetmap.org Git - rails.git/commitdiff
Use rails helpers to construct URLs
authorRajdeep Mandrekar <rajdeepmandrekar26@gmail.com>
Wed, 25 Apr 2018 19:38:41 +0000 (01:08 +0530)
committerTom Hughes <tom@compton.nu>
Wed, 25 Apr 2018 21:22:51 +0000 (22:22 +0100)
Fixes #1817
Closes #1840

app/controllers/diary_entry_controller.rb

index a3378a4c9c7d2886af91ea5bcd3b488b79228153..c0b974c5ede139bee5f1bd731154799bc79c61d2 100644 (file)
@@ -157,7 +157,7 @@ class DiaryEntryController < ApplicationController
         @entries = user.diary_entries
         @title = I18n.t("diary_entry.feed.user.title", :user => user.display_name)
         @description = I18n.t("diary_entry.feed.user.description", :user => user.display_name)
-        @link = "#{SERVER_PROTOCOL}://#{SERVER_URL}/user/#{user.display_name}/diary"
+        @link = url_for :controller => "diary_entry", :action => "list", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL
       else
         head :not_found
         return
@@ -169,11 +169,11 @@ class DiaryEntryController < ApplicationController
         @entries = @entries.where(:language_code => params[:language])
         @title = I18n.t("diary_entry.feed.language.title", :language_name => Language.find(params[:language]).english_name)
         @description = I18n.t("diary_entry.feed.language.description", :language_name => Language.find(params[:language]).english_name)
-        @link = "#{SERVER_PROTOCOL}://#{SERVER_URL}/diary/#{params[:language]}"
+        @link = url_for :controller => "diary_entry", :action => "list", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL
       else
         @title = I18n.t("diary_entry.feed.all.title")
         @description = I18n.t("diary_entry.feed.all.description")
-        @link = "#{SERVER_PROTOCOL}://#{SERVER_URL}/diary"
+        @link = url_for :controller => "diary_entry", :action => "list", :host => SERVER_URL, :protocol => SERVER_PROTOCOL
       end
     end