summaryrefslogtreecommitdiff
path: root/app/controllers/characters
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-13 21:40:42 -0400
committerDavid Gay <david@davidgay.org>2021-06-13 21:40:51 -0400
commit03b8bfa53b02754d7c375690d92ed83c1cd661da (patch)
tree175a6b7b7de6355a626f464b9881f1dfa3cf3d2d /app/controllers/characters
parent0637f55dd896a48f1dc3dd544f377b0f48017071 (diff)
Fix wrong param name in new CharacterController `#set_character`
Diffstat (limited to 'app/controllers/characters')
-rw-r--r--app/controllers/characters/skills_controller.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/characters/skills_controller.rb b/app/controllers/characters/skills_controller.rb
new file mode 100644
index 0000000..6fcf417
--- /dev/null
+++ b/app/controllers/characters/skills_controller.rb
@@ -0,0 +1,15 @@
+class Characters::SkillsController < ApplicationController
+ before_action :set_character, only: :index
+
+ def index
+ end
+
+ private
+ def set_character
+ @character = Character.find(params[:character_id])
+ unless current_char == @character
+ flash[:alert] = "You can only look at your own skills."
+ redirect_to character_path(@character)
+ end
+ end
+end