]> git.openstreetmap.org Git - rails.git/commitdiff
Pluralise user_preferences_controller
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 18 Apr 2018 03:22:37 +0000 (11:22 +0800)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 18 Apr 2018 03:26:00 +0000 (11:26 +0800)
This is the rails convention for controllers and can make route
generation easier.

http://guides.rubyonrails.org/action_controller_overview.html#controller-naming-convention

.rubocop_todo.yml
app/controllers/user_preferences_controller.rb [moved from app/controllers/user_preference_controller.rb with 97% similarity]
config/routes.rb
test/controllers/user_preferences_controller_test.rb [moved from test/controllers/user_preference_controller_test.rb with 93% similarity]

index 2c8d29eb887fac048d55a61cfcdb3d34e5138fa3..cdac8fd6718a4688403694f9ec1be7e6b917e2a4 100644 (file)
@@ -35,7 +35,7 @@ Lint/AssignmentInCondition:
     - 'app/controllers/notes_controller.rb'
     - 'app/controllers/trace_controller.rb'
     - 'app/controllers/user_controller.rb'
-    - 'app/controllers/user_preference_controller.rb'
+    - 'app/controllers/user_preferences_controller.rb'
     - 'app/helpers/application_helper.rb'
     - 'app/helpers/browse_helper.rb'
     - 'app/models/client_application.rb'
similarity index 97%
rename from app/controllers/user_preference_controller.rb
rename to app/controllers/user_preferences_controller.rb
index 16165513aefa217b11b1ac80520a89882de5d465..0aa2e8d523240c5f1eb3add8f6c978204bcab86f 100644 (file)
@@ -1,5 +1,5 @@
 # Update and read user preferences, which are arbitrayr key/val pairs
-class UserPreferenceController < ApplicationController
+class UserPreferencesController < ApplicationController
   skip_before_action :verify_authenticity_token
   before_action :authorize
   before_action :require_allow_read_prefs, :only => [:read_one, :read]
index ca0c4ecf01713a236a25f1fb834344adaabd2190..67deae7ed2e22733ce4897e4d1c1c07b04c97290 100644 (file)
@@ -68,11 +68,11 @@ OpenStreetMap::Application.routes.draw do
     get "user/details" => "user#api_details"
     get "user/gpx_files" => "user#api_gpx_files"
 
-    get "user/preferences" => "user_preference#read"
-    get "user/preferences/:preference_key" => "user_preference#read_one"
-    put "user/preferences" => "user_preference#update"
-    put "user/preferences/:preference_key" => "user_preference#update_one"
-    delete "user/preferences/:preference_key" => "user_preference#delete_one"
+    get "user/preferences" => "user_preferences#read"
+    get "user/preferences/:preference_key" => "user_preferences#read_one"
+    put "user/preferences" => "user_preferences#update"
+    put "user/preferences/:preference_key" => "user_preferences#update_one"
+    delete "user/preferences/:preference_key" => "user_preferences#delete_one"
 
     post "gpx/create" => "trace#api_create"
     get "gpx/:id" => "trace#api_read", :id => /\d+/
similarity index 93%
rename from test/controllers/user_preference_controller_test.rb
rename to test/controllers/user_preferences_controller_test.rb
index 7f614587d543903763de1bed468a151a7bdb5fa2..3e5cbb36998b3b3f03b40037f4756adfd122361f 100644 (file)
@@ -1,28 +1,28 @@
 require "test_helper"
 
-class UserPreferenceControllerTest < ActionController::TestCase
+class UserPreferencesControllerTest < ActionController::TestCase
   ##
   # test all routes which lead to this controller
   def test_routes
     assert_routing(
       { :path => "/api/0.6/user/preferences", :method => :get },
-      { :controller => "user_preference", :action => "read" }
+      { :controller => "user_preferences", :action => "read" }
     )
     assert_routing(
       { :path => "/api/0.6/user/preferences", :method => :put },
-      { :controller => "user_preference", :action => "update" }
+      { :controller => "user_preferences", :action => "update" }
     )
     assert_routing(
       { :path => "/api/0.6/user/preferences/key", :method => :get },
-      { :controller => "user_preference", :action => "read_one", :preference_key => "key" }
+      { :controller => "user_preferences", :action => "read_one", :preference_key => "key" }
     )
     assert_routing(
       { :path => "/api/0.6/user/preferences/key", :method => :put },
-      { :controller => "user_preference", :action => "update_one", :preference_key => "key" }
+      { :controller => "user_preferences", :action => "update_one", :preference_key => "key" }
     )
     assert_routing(
       { :path => "/api/0.6/user/preferences/key", :method => :delete },
-      { :controller => "user_preference", :action => "delete_one", :preference_key => "key" }
+      { :controller => "user_preferences", :action => "delete_one", :preference_key => "key" }
     )
   end