FIX: creating watched words...

... wasn't working because it wasn't storing the proper "action" value.

Issue was that we were using the "action" parameter which is being used by Rails to determine which controller action to call.

We need to use the "action_key" parameter instead.
This commit is contained in:
Régis Hanol
2024-04-30 18:08:37 +02:00
parent 0e44072b2b
commit e7d0083dbe
2 changed files with 5 additions and 16 deletions

View File

@ -14,7 +14,7 @@ class Admin::WatchedWordsController < Admin::StaffController
def create
opts = watched_words_params
action = opts[:action] || self.class.actions[opts[:action_key].to_sym]
action = WatchedWord.actions[opts[:action_key].to_sym]
words = opts.delete(:words)
watched_word_group = WatchedWordGroup.new(action: action)
@ -118,6 +118,6 @@ class Admin::WatchedWordsController < Admin::StaffController
def watched_words_params
@watched_words_params ||=
params.permit(:id, :replacement, :action, :action_key, :case_sensitive, words: [])
params.permit(:id, :replacement, :action_key, :case_sensitive, words: [])
end
end