Commit Graph

47865 Commits

Author SHA1 Message Date
claudiob
02e821f329 Wrap code snippets in +, not backticks, in sdoc
[ci skip]
2014-11-20 14:46:27 -08:00
Rafael Mendonça França
030c0532b9 Merge pull request #17688 from ilyakatz/request_method_instrumentation
Use request_method instead of method in instrumentation
2014-11-20 19:11:04 -02:00
Rafael Mendonça França
8ed5b46ce6 Merge pull request #17685 from claudiob/document-form-for-extra-options
Document *all* the options accepted by form_for

Conflicts:
	actionview/lib/action_view/helpers/form_helper.rb
2014-11-20 19:03:53 -02:00
Rafael Mendonça França
532e4808ff Merge pull request #17692 from robertomiranda/patch-1
_will_change! method is not needed any more [ci skip]
2014-11-20 19:01:56 -02:00
Rafael Mendonça França
6db9915ea8 Merge pull request #17690 from claudiob/add-enforce-utf8-to-form-for
Add `:enforce_utf8` option to form_for
2014-11-20 19:01:03 -02:00
Roberto Miranda
900f633aca _will_change! method is not needed any more [ci skip]
ref #15674
2014-11-20 15:59:01 -05:00
claudiob
b0cc858dd7 Add :enforce_utf8 option to form_for
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
2014-11-20 12:46:30 -08:00
claudiob
753600b240 Document *all* the options accepted by form_for
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](b0f44c9ff0/actionview/lib/action_view/helpers/form_helper.rb (L396)))
* `:method` is also a valid option (as [tested here](b0f44c9ff0/actionview/test/template/form_helper_test.rb (L1819)))
* `:remote` is also a valid option (as [tested here](b0f44c9ff0/actionview/test/template/form_helper_test.rb (L1850)))

[ci skip]
2014-11-20 12:39:58 -08:00
Ilya Katz
bc43d7f57d Use request method instead of ActionDispatch::Request#request_method instead of ActionDispatch::Request#method to pick up overrides by the middleware 2014-11-20 15:14:53 -05:00
Rafael Mendonça França
b0f44c9ff0 Merge pull request #17683 from tgxworld/improvements_to_active_job_guide
[CI SKIP] Improvements to Active Job guide.
2014-11-20 15:00:13 -02:00
Sean Griffin
347c226078 Merge pull request #17669 from SamSaffron/optimise_memory
PERF: avoid string allocations
2014-11-20 08:47:34 -08:00
Guo Xiang Tan
5758f26ba2 [CI SKIP] Improvements to Active Job guide. 2014-11-20 23:29:48 +08:00
Yves Senn
d56be864f6 synchronize code and docs for timestamps and add_timestamps.
This makes the following changes:
  * warn if `:null` is not passed to `add_timestamps`
  * `timestamps` method docs link to `add_timestamps` docs
  * explain where additional options go
  * adjust examples to include `null: false` (to prevent deprecation warnings)
2014-11-20 15:30:46 +01:00
Sam
a668b09ee3 PERF: avoid string allocations 2014-11-20 10:43:37 +11:00
Akira Matsuda
7839e27b4e Some valid block calls in templates caused syntax errors
Now ActionView accepts <%= foo(){ %> and <%= foo()do %> 
2014-11-20 07:21:50 +09:00
Rafael Mendonça França
7a5a3a8828 Merge pull request #17575 from shikshachauhan/make-habtm-consistent
Allow class_name option in habtm to be consistent with other association...
2014-11-19 18:33:31 -02:00
Rafael Mendonça França
70c2bf9d21 Fix shell quote on the release task 2014-11-19 18:30:06 -02:00
Sean Griffin
f767ac22fa Reintroduce cache with tests 2014-11-19 12:11:26 -08:00
Sean Griffin
cafed35b61 Add tests for TypeMap#fetch and push up to TypeMap
It doesn't make sense for the subclass to implement this method, and not
have it on the parent. We can also DRY up the implementation of
`#lookup` to be defined in terms of fetch, which will give us a single
point of entry
2014-11-19 12:11:26 -08:00
Rafael Mendonça França
e0c938759f Merge pull request #17677 from StevenNunez/patch-1
Remove bullet point to unwritten/unreferenced section
2014-11-19 17:33:10 -02:00
Steven Nunez
6d8f677ad9 Remove bullet point to unwritten/unreferenced section 2014-11-19 14:31:28 -05:00
Sean Griffin
7d54cccb84 That last test was incorrect... 2014-11-19 11:29:05 -08:00
Sean Griffin
b03f9ef86a Revert "PERF: optimise type lookup to avoid invoking procs"
This reverts commit da99a2a2982d35f670ad9647463e09bfe9032b70.
2014-11-19 11:24:49 -08:00
Sean Griffin
74c35b46e3 Introduce test to demonstrate regression caused by da99a2a2 2014-11-19 11:24:35 -08:00
Rafael Mendonça França
e430019672 Merge pull request #17662 from dtaniwaki/support-symbol-foreign-key-column-to-delete
Support symbol foreign key to delete
2014-11-19 13:53:06 -02:00
Rafael Mendonça França
75cfca0521 Merge pull request #17672 from radar/date-select-space
Add space in :start_year description for date_select
2014-11-19 11:52:51 -02:00
Ryan Bigg
97f2c4129a Add space in :start_year description for date_select 2014-11-19 19:20:37 +11:00
dtaniwaki
995c697511 Support symbol foreign key to delete 2014-11-19 10:17:44 +09:00
Akira Matsuda
644696e2ac Duplicated Hash key :prompt 2014-11-19 08:29:22 +09:00
Sean Griffin
08576b94ad Improve the performance of reading attributes
We added a comparison to "id", and call to `self.class.primary_key` a
*lot*. We also have performance hits from `&block` all over the place.
We skip the check in a new method, in order to avoid breaking the
behavior of `read_attribute`
2014-11-18 15:20:19 -08:00
Aaron Patterson
78e7a0d3b7 pull the preloader allocation in to a factory method 2014-11-18 14:22:33 -08:00
Sean Griffin
52fddcc653 Speed up integer casting from DB
We don't have the check the range when the value is coming from the DB,
so override type_cast_from_database to short-circuit the extra work.
The difference is huge but the absolute gain is quite small. That being
said this is a hotspot and it showed up on the radar when benchmarking
discourse.
2014-11-18 13:41:20 -08:00
Rafael Mendonça França
1b9e85dbbd Make sure assert_select can assert body tag
This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing
changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13.

Conflicts:
	actionpack/lib/action_controller/test_case.rb
	actionview/lib/action_view/test_case.rb
2014-11-18 18:47:22 -02:00
Sean Griffin
edc39ff756 Remove needless call to key? when building attributes
This appears to be a performance hotspot, see #17655.
2014-11-18 12:32:10 -08:00
Sean Griffin
3ecc5d30eb LazyAttributeHash is private 2014-11-18 12:32:09 -08:00
Sean Griffin
8b2c98f6c7 Remove call to key? in LazyAttributeHash#[]
Performance improvement, as well as improved code clarity
2014-11-18 12:32:09 -08:00
Rafael Mendonça França
6f5d633271 Merge pull request #17665 from javiervidal/fixing_documentation
Ruby on Rails 3.0 Release Notes: fix broken link
2014-11-18 15:01:29 -02:00
Javier Vidal
e1af263467 Ruby on Rails 3.0 Release Notes: fix broken link 2014-11-18 17:47:06 +01:00
Xavier Noria
b9a6ee8b89 Merge pull request #17660 from rishijain/update_docs_11
fixed minor typos in RELEASE doc [ci skip]
2014-11-18 12:39:57 +01:00
Rishi Jain
3f38762361 fixed minor typos in RELEASE doc [ci skip] 2014-11-18 16:55:54 +05:30
Xavier Noria
4fc493ff7e Merge pull request #17658 from SamSaffron/optimise_memory
PERF: stop allocating the string "id" over and over
2014-11-18 12:00:05 +01:00
Sam
9aa2b2d7bf PERF: stop allocating the string "id" over and over 2014-11-18 21:38:27 +11:00
Godfrey Chan
3098579f27 Revert "[PERF] Speed up integer type casting from DB"
This reverts commit 6f7910a and 52c70d4.

Query params are type cased through the same method, so this approach doesn't work.
2014-11-17 18:34:29 -08:00
Godfrey Chan
52c70d496f 💅 Put escape clause first, keeps @sgrif happy 😁
See comment on 6f7910a
2014-11-17 18:09:40 -08:00
Godfrey Chan
6f7910aed5 [PERF] Speed up integer type casting from DB
We don't have the check the range when the value is coming from the DB, so
override type_cast_from_database to short-circuit the extra work.

type_cast_from_database (small)  3437507.5 (±29.2%) i/s -   14223135 in   4.996973s
type_cast_from_database (large)  3158588.7 (±28.3%) i/s -   13265628 in   4.992121s
type_cast (small)                 481984.8 (±14.2%) i/s -    2352012 in   5.005694s
type_cast (large)                 477331.8 (±14.2%) i/s -    2332824 in   5.012365s

Comparison:
type_cast_from_database (small):  3437507.5 i/s
type_cast_from_database (large):  3158588.7 i/s - 1.09x slower
type_cast (small):                 481984.8 i/s - 7.13x slower
type_cast (large):                 477331.8 i/s - 7.20x slower

The difference is huge but the absolute gain is quite small. That being said
this is a hotspot and it showed up on the radar when benchmarking discourse.
2014-11-17 17:58:49 -08:00
Sean Griffin
eb26f24bde Remove the unused second argument to substitute_at
Oh hey, we got to remove some code because of that!
2014-11-17 15:04:40 -08:00
Sean Griffin
c01b20b658 rm reorder_bind_params
Arel handles this for us automatically. Updated tests, as BindParam is
no longer a subclass of SqlLiteral. We should remove the second argument
to substitute_at entirely, as it's no longer used
2014-11-17 14:57:01 -08:00
Sean Griffin
bf149679f4 Force table creation in tests
If something causes the teardown block to not get run (errors,
interrupting test runs), we have to manually delete them, which is a
pain.
2014-11-17 14:57:01 -08:00
Rafael Mendonça França
916731686b Generate new applications with the right rails-dom-testing version 2014-11-17 16:44:15 -02:00
Rafael Mendonça França
27a181f751 Use GitHub, not my local fork 😅 2014-11-17 16:38:30 -02:00