From 5edbc1fd2034f79e41638d8e67324c7d357002d6 Mon Sep 17 00:00:00 2001 From: Raghu Kamat Date: Thu, 25 Oct 2018 09:13:39 -0400 Subject: [PATCH] Added maxlength example to text_field documentation The usage of maxlength in the text_field helper adds a size attribute to the generated text_field input with the same value as the maxlength. This implicit addition of size attribute by the method gives a false impression that it may be bug. By adding the implementation of the maxlength to the api docs, we explicitly tell the reader referring the api doc that addition of size along with maxlength is the expected behaviour. [ci skip] --- actionview/lib/action_view/helpers/form_helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 6e769aa560..c2caa77afb 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -1130,6 +1130,9 @@ module ActionView # text_field(:post, :title, class: "create_input") # # => # + # text_field(:post, :title, maxlength: 30, class: "title_input") + # # => + # # text_field(:session, :user, onchange: "if ($('#session_user').val() === 'admin') { alert('Your login cannot be admin!'); }") # # => #