From cf51f165cdf9fba04bf40e919886d307e83aeb9c Mon Sep 17 00:00:00 2001 From: uu59 Date: Thu, 31 Jul 2014 18:30:13 +0900 Subject: [PATCH] setting_params should be normally --- .../fluentd/settings/in_tail_controller.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/fluentd/settings/in_tail_controller.rb b/app/controllers/fluentd/settings/in_tail_controller.rb index c508dc5..85d849c 100644 --- a/app/controllers/fluentd/settings/in_tail_controller.rb +++ b/app/controllers/fluentd/settings/in_tail_controller.rb @@ -10,7 +10,12 @@ class Fluentd::Settings::InTailController < ApplicationController end def after_format - @setting = Fluentd::Setting::InTail.new(setting_params) + # NOTE: pos_file form field doesn't exists before this action + attrs = setting_params + if attrs[:pos_file].blank? + attrs.merge!(pos_file: "/tmp/fluentd-#{@fluentd.id}-#{Time.now.to_i}.pos") + end + @setting = Fluentd::Setting::InTail.new(attrs) end def confirm @@ -46,10 +51,7 @@ class Fluentd::Settings::InTailController < ApplicationController private def setting_params - setting_params = params.require(:setting).permit(:path, :format, :regexp, *Fluentd::Setting::InTail.known_formats, :tag, :rotate_wait, :pos_file, :read_from_head, :refresh_interval) - { - :pos_file => "/tmp/fluentd-#{@fluentd.id}-#{Time.now.to_i}.pos", - }.merge setting_params + params.require(:setting).permit(:path, :format, :regexp, *Fluentd::Setting::InTail.known_formats, :tag, :rotate_wait, :pos_file, :read_from_head, :refresh_interval) end end