Skip to content

Commit

Permalink
Replace to use of ActionController::Parameters#expect for strong para…
Browse files Browse the repository at this point in the history
…meter
  • Loading branch information
taketo1113 committed Jan 20, 2025
1 parent fc6697e commit 1ab5bd4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ inherit_gem: { rubocop-rails-omakase: rubocop.yml }
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
# Layout/SpaceInsideArrayLiteralBrackets:
# Enabled: false
Rails/StrongParametersExpect:
Enabled: true
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ GEM
foreman (0.88.1)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.6)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.8.0)
irb (1.14.3)
Expand Down Expand Up @@ -322,7 +322,7 @@ GEM
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.28.0)
rubocop-rails (2.29.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/diagnosis_logs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ def set_diagnosis_log

# Never trust parameters from the scary internet, only allow the white list through.
def diagnosis_log_params
params.require(:diagnosis_log).permit(:layer, :log_group, :log_type, :target, :log_campaign_uuid, :result, :detail, :occurred_at)
params.expect(diagnosis_log: [ :layer, :log_group, :log_type, :target, :log_campaign_uuid, :result, :detail, :occurred_at ])
end
end
2 changes: 1 addition & 1 deletion app/controllers/ignore_error_results_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ def set_ignore_error_result

# Never trust parameters from the scary internet, only allow the white list through.
def ignore_error_result_params
params.require(:ignore_error_result).permit(:ssid, ignore_log_types: [])
params.expect(ignore_error_result: [ :ssid, ignore_log_types: [] ])
end
end
2 changes: 1 addition & 1 deletion app/controllers/log_campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@ def set_log_campaign

# Never trust parameters from the scary internet, only allow the white list through.
def log_campaign_params
params.require(:log_campaign).permit(:log_campaign_uuid, :ssid, :network_type, :mac_addr, :os, :version, :occurred_at)
params.expect(log_campaign: [ :log_campaign_uuid, :ssid, :network_type, :mac_addr, :os, :version, :occurred_at ])
end
end

0 comments on commit 1ab5bd4

Please sign in to comment.