class ActionView::Helpers::FormBuilder

def button(value = nil, options = {}, &block)


#
# Save as draft
# =>
# Create post
# =>
# Ask me!
# =>
button(:draft, value: true)

# =>
button("Create post")
==== Examples

create: "Add %{model}"
post:
submit:
helpers:
en:

It also searches for a key specific to the given object:

update: "Confirm changes to %{model}"
create: "Create a %{model}"
submit:
helpers:
en:

(the same as submit helper) and using %{model} for translation interpolation:
Those labels can be customized using I18n under the +helpers.submit+ key

button label; otherwise, it uses "Update Post".
In the example above, if @post is a new record, it will use "Create Post" as

<% end %>
<%= f.button %>
<%= form_for @post do |f| %>

if the object is a new resource or not to create the proper label:
Add the submit button for the given form. When no value is given, it checks
def button(value = nil, options = {}, &block)
  case value
  when Hash
    value, options = nil, value
  when Symbol
    value, options = nil, { name: field_name(value), id: field_id(value) }.merge!(options.to_h)
  end
  value ||= submit_default_value
  if block_given?
    value = @template.capture { yield(value) }
  end
  formmethod = options[:formmethod]
  if formmethod.present? && !/post|get/i.match?(formmethod) && !options.key?(:name) && !options.key?(:value)
    options.merge! formmethod: :post, name: "_method", value: formmethod
  end
  @template.button_tag(value, options)
end