From f49745d7bac07ab852a326e1f6ebfdf62e7ef3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 25 Jun 2020 15:12:07 +0200 Subject: [PATCH] Simplify passing the object in the form builder The object is already a method, so we don't need to pass it around. --- lib/consul_form_builder.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/consul_form_builder.rb b/lib/consul_form_builder.rb index 3e60bfccf..7e4cffe2a 100644 --- a/lib/consul_form_builder.rb +++ b/lib/consul_form_builder.rb @@ -21,7 +21,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder def check_box(attribute, options = {}) if options[:label] != false - label = tag.span sanitize(label_text(object, attribute, options[:label])), class: "checkbox" + label = tag.span sanitize(label_text(attribute, options[:label])), class: "checkbox" super(attribute, options.merge(label: label, label_options: label_options_for(options))) else @@ -41,7 +41,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder if text == false super else - super(attribute, sanitize(label_text(object, attribute, text)), options) + super(attribute, sanitize(label_text(attribute, text)), options) end end @@ -50,7 +50,7 @@ class ConsulFormBuilder < FoundationRailsHelper::FormBuilder help_text(attribute, options) end - def label_text(object, attribute, text) + def label_text(attribute, text) if text.nil? || text == true default_label_text(object, attribute) else