Skip to content

Commit 69f5873

Browse files
committed
Rename model parameter
1 parent a85d619 commit 69f5873

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

app/controllers/ruby_lsp/rails/models_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ModelsController < ApplicationController
88

99
sig { returns(T.untyped) }
1010
def show
11-
const = Object.const_get(params[:id]) # rubocop:disable Sorbet/ConstantsFromStrings
11+
const = Object.const_get(params[:model]) # rubocop:disable Sorbet/ConstantsFromStrings
1212

1313
begin
1414
schema_file = ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(const.connection.pool.db_config)

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# frozen_string_literal: true
33

44
RubyLsp::Rails::Engine.routes.draw do
5-
resources :models, only: [:show]
5+
resources :models, only: [:show], param: :model
66
end

sorbet/rbi/shims/actiondispatch.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module ActionDispatch
55
class IntegrationTest
6-
sig { params(id: String).returns(String) }
7-
def model_url(id:); end
6+
sig { params(model: String).returns(String) }
7+
def model_url(model:); end
88
end
99
end

test/controllers/ruby_lsp_rails/models_controller_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ModelsControllerTest < ActionDispatch::IntegrationTest
99
T.unsafe(self).include(Engine.routes.url_helpers)
1010

1111
test "GET show returns column information for existing models" do
12-
get model_url(id: "User")
12+
get model_url(model: "User")
1313
assert_response(:success)
1414
assert_equal(
1515
{
@@ -28,12 +28,12 @@ class ModelsControllerTest < ActionDispatch::IntegrationTest
2828
end
2929

3030
test "GET show returns not_found if model doesn't exist" do
31-
get model_url(id: "NonExistentModel")
31+
get model_url(model: "NonExistentModel")
3232
assert_response(:not_found)
3333
end
3434

3535
test "GET show returns not_found if class is not a model" do
36-
get model_url(id: "ApplicationJob")
36+
get model_url(model: "ApplicationJob")
3737
assert_response(:not_found)
3838
end
3939
end

0 commit comments

Comments
 (0)