Class: RailsDevtools::Routes::RoutePathInputsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rails_devtools/routes/route_path_inputs_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/rails_devtools/routes/route_path_inputs_controller.rb', line 6

def update
  route = Routes::Collection.find(params[:id])

  input_params = { route: route }

  if params[:engine_prefix].present? && params[:engine_prefix] == "1"
    input_params.merge!(prefix: route.engine_info.helper_prefix)
  end

  if params[:url_suffix].present? && params[:url_suffix] == "1"
    input_params.merge!(suffix: "url")
  end

  render Routes::RouteDetails::RoutePathInput.new(**input_params)
end