Flowdock
submit_default_value() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
April 5, 2021 - (v3.0.0 - v6.1.3.1)
0 thanks

Returns a string used for submit button label

This private method returns the label used for the `f.submit` helper.

apidock.com/rails/v5.2.3/ActionView/Helpers/FormBuilder/submit

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

In the example above, if @post is a new record, this method returns “Create Post” as submit button label; otherwise, it uses “Update Post”.

This method also checks for custom language using I18n under the helpers.submit key and using %{model} for translation interpolation:

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

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

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