Permalink
Browse files

Merge pull request #14780 from zenati/master

[ci skip] Added examples for search_field_tag method
  • Loading branch information...
2 parents 11eb1e3 + 4d566ee commit 4134d4240c5aded548765bf1797425cc5ab71f3c @rafaelfranca rafaelfranca committed Apr 16, 2014
Showing with 13 additions and 0 deletions.
  1. +13 −0 actionview/lib/action_view/helpers/form_tag_helper.rb
@@ -571,6 +571,19 @@ def color_field_tag(name, value = nil, options = {})
#
# ==== Options
# * Accepts the same options as text_field_tag.
+ #
+ # ==== Examples
+ # search_field_tag 'name'
+ # # => <input id="name" name="name" type="search" />
+ #
+ # search_field_tag 'search', 'Enter your search query here'
+ # # => <input id="search" name="search" type="search" value="Enter your search query here" />
+ #
+ # search_field_tag 'search', nil, class: 'special_input'
+ # # => <input class="special_input" id="search" name="search" type="search" />
+ #
+ # search_field_tag 'search', 'Enter your search query here', class: 'special_input', disabled: true
+ # # => <input disabled="disabled" class="special_input" id="search" name="search" type="search" value="Enter your search query here" />
def search_field_tag(name, value = nil, options = {})
text_field_tag(name, value, options.stringify_keys.update("type" => "search"))
end

0 comments on commit 4134d42

Please sign in to comment.