diff options
author | Marius Peter <marius.peter@tutanota.com> | 2025-01-01 18:02:43 +0100 |
---|---|---|
committer | Marius Peter <marius.peter@tutanota.com> | 2025-01-01 18:02:43 +0100 |
commit | cff1e4fc3596943db63603c614eb08945130eeaa (patch) | |
tree | 1b74b3b8bd8d381208f52418a95cadfcc4b84cd8 | |
parent | 84ef779f985dad79081bb87dd85d37ae0bc3d73d (diff) |
Rubocop 👮
-rw-r--r-- | app/controllers/scores_controller.rb | 2 | ||||
-rw-r--r-- | app/models/score.rb | 2 | ||||
-rw-r--r-- | config/routes.rb | 8 | ||||
-rw-r--r-- | db/migrate/20250101141642_add_unique_index_to_scores.rb | 2 | ||||
-rw-r--r-- | test/models/score_test.rb | 2 |
5 files changed, 7 insertions, 9 deletions
diff --git a/app/controllers/scores_controller.rb b/app/controllers/scores_controller.rb index 8754b91..7c46165 100644 --- a/app/controllers/scores_controller.rb +++ b/app/controllers/scores_controller.rb @@ -1,6 +1,6 @@ class ScoresController < ApplicationController allow_unauthenticated_access - before_action :set_tartiflette, only: [:new, :create, :edit_all, :update_all] + before_action :set_tartiflette, only: [ :new, :create, :edit_all, :update_all ] def new end diff --git a/app/models/score.rb b/app/models/score.rb index ccc795f..efbfee1 100644 --- a/app/models/score.rb +++ b/app/models/score.rb @@ -5,7 +5,7 @@ class Score < ApplicationRecord validates :value, presence: true, inclusion: { in: 1..5 } validates :session_id, presence: true validates :tartiflette_id, uniqueness: { - scope: [:scoring_criterium_id, :session_id], + scope: [ :scoring_criterium_id, :session_id ], message: "has already been scored for this session and criterium." } end diff --git a/config/routes.rb b/config/routes.rb index 645f807..6cb738b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,12 +12,12 @@ Rails.application.routes.draw do to: "code_of_honor#toggle", as: :toggle_code_of_honor - post '/accept_cookies', - to: 'sessions#accept_cookies', + post "/accept_cookies", + to: "sessions#accept_cookies", as: :accept_cookies - post '/gift_nico', - to: 'sessions#gift_nico', + post "/gift_nico", + to: "sessions#gift_nico", as: :gift_nico resources :tartiflettes do diff --git a/db/migrate/20250101141642_add_unique_index_to_scores.rb b/db/migrate/20250101141642_add_unique_index_to_scores.rb index 8efde1f..2991059 100644 --- a/db/migrate/20250101141642_add_unique_index_to_scores.rb +++ b/db/migrate/20250101141642_add_unique_index_to_scores.rb @@ -1,7 +1,7 @@ class AddUniqueIndexToScores < ActiveRecord::Migration[8.0] def change add_index :scores, - [:tartiflette_id, :scoring_criterium_id, :session_id], + [ :tartiflette_id, :scoring_criterium_id, :session_id ], unique: true, name: "index_scores_on_tartiflette_criterium_session" end diff --git a/test/models/score_test.rb b/test/models/score_test.rb index ecf5558..253859a 100644 --- a/test/models/score_test.rb +++ b/test/models/score_test.rb @@ -44,6 +44,4 @@ class ScoreTest < ActiveSupport::TestCase assert_not @score.valid?, "Score should not be valid without a session_id." assert_includes @score.errors[:session_id], "can't be blank" end - - end |