| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
stevenspiel/titleize_model_name_for_default_submit_button_value"
This reverts commit 4158974c60d817c9bc1e2aecb342161295f2ac0d, reversing
changes made to 3d590add45b7ff1de972d99b076cb504d5208935.
Reason: This break i18n in some languages. See
https://github.com/rails/rails/issues/791#issuecomment-192724640
|
|
|
|
|
|
| |
of html_safe in favour of raw() in AV helpers.
Also changed usage of html_safe to make use of raw() instead so that the intended behaviour is verified with raw()
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When this method was implemented
(https://github.com/rails/rails/pull/5016/files), `to_date` is called.
But this behavior was chagned refactoring
(https://github.com/rails/rails/pull/6452/files).
In the first commit, there were not test which asserts `to_date` is called.
I think trying `to_date` is more useful than trying `strftime`, because
we can write `"2015-01-01".to_date`. But first fix comments to match
actual behavior.
|
|\
| |
| | |
Handle nested fields_for by adding indexes to record_name
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In case of the form with nested fields_for, i. e.
<%= form_for :foos, url: root_path do |f| %>
<% @foos.each do |foo| %>
<%= f.fields_for 'foo[]', foo do |f2| %>
<%= f2.text_field :id %>
<% foo.bars.each do |bar| %>
<%= f2.fields_for 'bar[]', bar do |b| %>
<%= b.text_field :id %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= f.submit %>
<% end %>
rails doesn't add index for 'foo' in the inner fields_for block, so field names
in the outer fields_for looks like "foos[foo][#{foo_index}][id]" and in the
inner "foos[foo[]][bar][#{bar_index}][id]". Submitting of such form leads to an
error like:
>ActionController::BadRequest (Invalid request parameters: expected Array
>(got Rack::QueryParser::Params) for param `foo'):
This commit adds indexes for the foos in the inner blocks, so field names
become "foos[foo][#{foo_index}][bar][#{bar_index}][id]" and submitting of such
form works fine as expected.
Fixes #15332
|
| | |
|
| | |
|
|/ |
|
|\ |
|
| | |
|
| | |
|
|/ |
|
| |
|
|\
| |
| |
| |
| | |
Conflicts:
guides/source/4_0_release_notes.md
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The previous change 92a3c8dcdf174dab5e8759031b6bbe6cd891fe3c improved
this example, but calling .create + #valid? ends up running validations
twice, and we don't want to showcase that.
Lets use the normal use case of building a new object and calling #save
on it, which is what a basic scaffold with Active Record does.
[ci skip]
|
|/ |
|
| |
|
| |
|
|\
| |
| |
| | |
Rename default_form_builder to avoid collision
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Per DHH in #18337, ActionView::Helpers::RecordTagHelper has been
extracted to an external gem (source currently lives at
todd/record_tag_helper). Removal notices have also been added for anyone
upgrading that use the extracted methods.
|
| | |
|
| |
| |
| |
| |
| | |
This will avoid a error be raised when the only input on the form is the
`file_field`.
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Document *all* the options accepted by form_for
Conflicts:
actionview/lib/action_view/helpers/form_helper.rb
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The [current documentation of form_for](http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for) is incomplete:
> The rightmost argument to form_for is an optional hash of options -
> :url - The URL the form is to be submitted to. This may be represented in the same way as values passed to url_for or link_to. So for example you may use a named route directly. When the model is represented by a string or symbol, as in the example above, if the :url option is not specified, by default the form will be sent back to the current url (We will describe below an alternative resource-oriented usage of form_for in which the URL does not need to be specified explicitly).
> :namespace - A namespace for your form to ensure uniqueness of id attributes on form elements. The namespace attribute will be prefixed with underscore on the generated HTML id.
> :html - Optional HTML attributes for the form tag.
This commit completes the documentation by specifying that:
* `:authenticity_token` is also a valid option (as [documented here](https://github.com/rails/rails/blob/b0f44c9ff0be84ebc42760029adeeb9dd954655f/actionview/lib/action_view/helpers/form_helper.rb#L396))
* `:method` is also a valid option (as [tested here](https://github.com/rails/rails/blob/b0f44c9ff0be84ebc42760029adeeb9dd954655f/actionview/test/template/form_helper_test.rb#L1819))
* `:remote` is also a valid option (as [tested here](https://github.com/rails/rails/blob/b0f44c9ff0be84ebc42760029adeeb9dd954655f/actionview/test/template/form_helper_test.rb#L1850))
[ci skip]
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| | |
Since 06388b0 `form_tag` accepts the option `enforce_utf8` which, when set to
false, prevents the hidden "UTF8 enforcer" field from appearing in the output.
This commit implements the same behavior for `form_for`.
Stems from https://github.com/rails/rails/pull/17685#issuecomment-63871395
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
[ci skip]
89ff1f8 and 1de258e6 removed from the HTML generated by the form helpers
the <div> that was wrapping the field elements inside the <form>.
This commit updates the documentation of the methods to reflect the
two commits above.
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
actionpack/lib/action_controller/metal/mime_responds.rb
actionview/lib/action_view/vendor/html-scanner/html/sanitizer.rb
activerecord/lib/active_record/type/value.rb
|
| |
| |
| |
| | |
[skip ci]
|
|\ \
| |/
|/|
| | |
Use #model_name on instances instead of classes
|
| |
| |
| |
| |
| |
| | |
This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class.
Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
| |
For some reason, if the hash is empty, we choose "optimized" routes. I
am not sure how or why optimized routes differ from regular routes.
But, if we make sure the hash is empty, we get a nice speed improvement.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The use of `display:inline` with the content_tag call in the
extra_tags_for_form method potentially causes display issues with some
browsers, namely Internet Explorer. IE's behaviour of not collapsing
the line height on divs with ostensibly no content means that the
automatically added div containing the hidden authenticity_token, utf8
and _method form input tags may interfere with other visible form
elements in certain circumstances. The use of `display:none` rather
than `display:inline` fixes this problem.
Fixes #6403
|
| |
|
|\
| |
| | |
Remove deprecated cattr_* requires
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
|
| |
:as option should not overwrite :namespace option when
generating html id attribute of the form element. id should be prefixed
by specified namespace even if :as option is present
Add test case showing the issue and code fixing it
|
|
|
|
| |
tests
|
|
|