From df44beb9a39da2cb84ad46bd231cc9cc854dd5e6 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Tue, 10 Sep 2019 10:02:24 +1000 Subject: [PATCH] FIX: Save on chat_controller ready for Rails 6.0.0 (#31) I think that passing attributes to save method is not necessary when the Object was initialized with them. Problem is that with Rails 6.0.0 (https://github.com/discourse/discourse/pull/8083) this code is not working https://travis-ci.org/discourse/discourse/jobs/582556988 --- app/controllers/chat_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/chat_controller.rb b/app/controllers/chat_controller.rb index d9dbf1c..1312671 100644 --- a/app/controllers/chat_controller.rb +++ b/app/controllers/chat_controller.rb @@ -79,7 +79,7 @@ class DiscourseChat::ChatController < ApplicationController channel = DiscourseChat::Channel.new(hash) - if !channel.save(hash) + if !channel.save raise Discourse::InvalidParameters, 'Channel is not valid' end @@ -121,7 +121,7 @@ class DiscourseChat::ChatController < ApplicationController hash = params.require(:rule).permit(:channel_id, :type, :filter, :group_id, :category_id, tags: []) rule = DiscourseChat::Rule.new(hash) - if !rule.save(hash) + if !rule.save raise Discourse::InvalidParameters, 'Rule is not valid' end