Commit Graph

1965 Commits

Author SHA1 Message Date
Arun Agrawal
50e3680768 Bump license years for 2019 2018-12-31 10:24:38 +07:00
yuuji.yaginuma
dea817410e Generate doc of methods provided by form builders [ci skip]
Because method arguments are different in the methods provided by form
helpers and form builders, I think these are necessary to prevent
confusion.

Fixes #34787
2018-12-26 19:53:48 +09:00
Ryuta Kamizono
b75192845a
Merge pull request #34764 from kamipo/avoid_redundant_begin
Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin block
2018-12-21 17:36:30 +09:00
Vinicius Stock
1ff2213313 Fix integer regex deprecation warnings for Ruby 2.6.0 (#34728)
* Fix integer regex deprecation warnings for Ruby 2.6.0
* Define =~ in FakeZone to avoid warnings from Ruby 2.6.0
2018-12-21 08:19:41 +09:00
Ryuta Kamizono
892e38c78e Enable Style/RedundantBegin cop to avoid newly adding redundant begin block
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).

I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
2018-12-21 06:12:42 +09:00
Ryuta Kamizono
8034dde023 Module#{define_method,alias_method,undef_method,remove_method} become public since Ruby 2.5
https://bugs.ruby-lang.org/issues/14133
2018-12-21 01:39:18 +09:00
Kasper Timm Hansen
1b7c3222e8
Require Ruby 2.5 for Rails 6.
Generally followed the pattern for https://github.com/rails/rails/pull/32034

* Removes needless CI configs for 2.4
* Targets 2.5 in rubocop
* Updates existing CHANGELOG entries for fewer merge conflicts
* Removes Hash#slice extension as that's inlined on Ruby 2.5.
* Removes the need for send on define_method in MethodCallAssertions.
2018-12-19 21:47:50 +01:00
Javan Makhmali
2f6456cbe1
Merge pull request #34635 from WoH/data-disable-forever
UJS: Do not disable previously disabled elements
2018-12-18 10:54:12 -05:00
Ryuta Kamizono
30eab94d2f
Fix View.new method call with arguments syntax
[ci skip]
2018-12-18 07:16:55 +09:00
T.J. Schuck
1981fb2dfd Fix doc formatting
[ci skip]
2018-12-17 16:10:26 -05:00
pavel
01b0ccce32 use match? 2018-12-12 23:29:53 +01:00
Ivan Kuchin
1be4edc76f
Fix typos in click test descriptions [ci skip] 2018-12-10 23:44:31 +01:00
WoH
257a1a6373
Do not disable previously disabled elements 2018-12-06 09:02:07 +01:00
WoH
a2612622e8
Prevent unintended mouse keys from firing click events
Firefox fires click events on left-, right-
and scroll-wheel (any non-primary mouse key) clicks while other browsers don't.
2018-12-05 15:08:14 +01:00
Lyle Mullican
4fdc6269b6 Prevent TextHelper#word_wrap from stripping white space on the left
side of long lines; Fixes #34487
2018-11-19 17:16:34 -05:00
Ryuta Kamizono
5df4efd2fd Fix broken CHANGELOG markup [ci skip]
And remove trailing spaces.
2018-11-08 09:28:42 +09:00
Gannon McGibbon
e74fdbe00c Amend CVE note and security guide section wordings
Reword first sentence of dep management and CVE section of
security guide. Also, reword and move gemspec notes above deps.

[ci skip]
2018-11-06 18:06:57 -05:00
Gannon McGibbon
1c11688b56 Add CVE note to security guide and gemspecs
[ci skip]
2018-11-06 14:25:36 -05:00
Raghu Kamat
5edbc1fd20 Added maxlength example to text_field documentation
The usage of maxlength in the text_field helper adds a size attribute
to the generated text_field input with the same value as the maxlength.
This implicit addition of size attribute by the method gives a false
impression that it may be bug. By adding the implementation of the
maxlength to the api docs, we explicitly tell the reader referring the
api doc that addition of size along with maxlength is the expected behaviour.

[ci skip]
2018-10-25 16:00:59 -04:00
Eileen Uchitelle
e8c1be4ae7 Add allocations to template renderer subscription
This PR adds the allocations to the instrumentation for template and
partial rendering.

Before:

```
  Rendering posts/new.html.erb within layouts/application
  Rendered posts/_form.html.erb (9.7ms)
  Rendered posts/new.html.erb within layouts/application (10.9ms)
Completed 200 OK in 902ms (Views: 890.8ms | ActiveRecord: 0.8ms)
```

After:

```
  Rendering posts/new.html.erb within layouts/application
  Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004)
  Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654)
Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564)
```
2018-10-10 08:07:12 -04:00
Ryuta Kamizono
d4127a014c
Merge pull request #33324 from Jcambass/fix-only-path-option-in-url-for-with-arrays
respect only_path option when an array is passed into url_for
2018-10-08 17:52:39 +09:00
bogdanvlviv
42469c5061
Fix rubocop issue
Fixes: `Layout/TrailingWhitespace: Trailing whitespace detected.

See https://codeclimate.com/github/rails/rails/issues

Releted to b707a6d0eb7
2018-10-03 23:31:40 +03:00
Sharang Dashputre
3c4b729f48 Fix spellings for 'unmarshall(ing/ed)' & 'marshall(ing/ed)' 2018-10-02 13:55:39 +05:30
Joel Ambass
b48c2ade09 respect path_only option when an array is passed into url_for
The url_for method is now extracting the path_only option in order to determine if polymorphic_path or polymorphic_url should be called.

If the path_only option is not set it will be set to true unless the host option is set. This behaviour is the same as when a Hash or Params object is passed.

To support this unifying the code responsible for setting this default value has been extracted into a private method
2018-10-01 19:31:08 +02:00
Ryuta Kamizono
b13a5cb83e
Merge pull request #32031 from yahonda/remove_redundant_freeze
Add `Style/RedundantFreeze` to remove redudant `.freeze`
2018-10-01 10:08:51 +09:00
David Heinemeier Hansson
b707a6d0eb
Explain why we have explicit marshaling methods 2018-09-30 16:55:16 -07:00
lsylvester
9d7d6336d7 make actionview templates marshalable so that they can be serialized during the parallel tests (#34030) 2018-09-30 16:50:57 -07:00
Yasuo Honda
aa3dcabd87 Add Style/RedundantFreeze to remove redudant .freeze
Since Rails 6.0 will support Ruby 2.4.1 or higher
`# frozen_string_literal: true` magic comment is enough to make string object frozen.
This magic comment is enabled by `Style/FrozenStringLiteralComment` cop.

* Exclude these files not to auto correct false positive `Regexp#freeze`
 - 'actionpack/lib/action_dispatch/journey/router/utils.rb'
 - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb'

It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333
Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed.

* Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required

 - 'actionpack/test/controller/test_case_test.rb'
 - 'activemodel/test/cases/type/string_test.rb'
 - 'activesupport/lib/active_support/core_ext/string/strip.rb'
 - 'activesupport/test/core_ext/string_ext_test.rb'
 - 'railties/test/generators/actions_test.rb'
2018-09-29 07:18:44 +00:00
Patrik Bóna
8e07711d65 Do not enable disabled elements for XHR redirects
Fixes #29473.
2018-09-27 10:59:56 +02:00
Rafael França
05a66686f1
Merge pull request #33975 from JuanitoFatas/jf.fix-test-name
[CaptureHelperTest] Fix a content_for test description
2018-09-25 17:54:30 -04:00
Rafael Mendonça França
49f9dff9b6
Fix more offences 2018-09-25 13:21:40 -04:00
Rafael Mendonça França
f679933daa
Change the empty block style to have space inside of the block 2018-09-25 13:19:35 -04:00
Aaron Patterson
6d698fdb07
Merge pull request #33973 from rails/remove-catch-all
Remove deprecated catch-all route in the AV tests
2018-09-25 09:27:37 -07:00
Juanito Fatas
6f36168eca Fix a content_for test description 2018-09-25 15:15:35 +09:00
Aaron Patterson
3301804ff6
make bot happy 2018-09-24 16:01:34 -07:00
Aaron Patterson
4f96e739c2
Remove deprecated catch-all route in the AV tests
This commit removes a deprecated catch-all route in the AV tests.  It
defines and includes the necessary routes for each test such that we
don't need the catch-all anymore.

This also helps push us toward #33970
2018-09-24 15:39:15 -07:00
Kasper Timm Hansen
22dc2b3db8
Merge pull request #33949 from sjain1107/no-private-def
Remove private def
2018-09-23 19:39:15 +02:00
Sakshi Jain
0fe2bb816f Remove private def 2018-09-23 21:27:44 +05:30
yuuji.yaginuma
1b86d90136 Enable Performance/UnfreezeString cop
In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`.

```ruby
# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  gem "benchmark-ips"
end

Benchmark.ips do |x|
  x.report('+@') { +"" }
  x.report('dup') { "".dup }
  x.compare!
end
```

```
$ ruby -v benchmark.rb
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Warming up --------------------------------------
                  +@   282.289k i/100ms
                 dup   187.638k i/100ms
Calculating -------------------------------------
                  +@      6.775M (± 3.6%) i/s -     33.875M in   5.006253s
                 dup      3.320M (± 2.2%) i/s -     16.700M in   5.032125s

Comparison:
                  +@:  6775299.3 i/s
                 dup:  3320400.7 i/s - 2.04x  slower

```
2018-09-23 08:56:55 +09:00
Rafael França
013749ecff
Merge pull request #33564 from avit/escape_javascript_casting
Let escape_javascript handle conversion to string
2018-09-21 17:06:45 -04:00
Andrew Vit
dd0cfb03b2 Let escape_javascript handle conversion to string
This brings `escape_javascript` in line with the behavior of `json_escape` and
allows other value types to be output without needing explicit casting in the
view template.

Example:

    <%= javascript_tag do %>
      var locale = '<%== j I18n.locale %>'; // locale is a symbol
    <% end %>
2018-09-21 12:30:40 -07:00
schneems
e8283dabd2 [ci skip] document collection_caching.rb 2018-09-19 18:03:16 -05:00
John Hawthorn
a33776b0f5 Fix for variants: :any special case 2018-09-12 18:22:09 -07:00
John Hawthorn
cc9a0de660 Use wildcard glob for optimized template resolving 2018-09-12 17:54:23 -07:00
schneems
99d260298c Move digest path calculation out of loop
On every iteration of generating a cache for a collection a “digest path” is calculated even though it’s exactly the same for every element.

This PR exposes a method `digest_path_from_virtual` that returns back a “digest_path”. This can in turn be passed back into `cache_fragment_name`. This not only does less work, but it also (you guessed it) uses  less memory.

before: Total allocated: 762539 bytes (7035 objects)
after: Total allocated: 743590 bytes (6621 objects) 


(762539 - 743590)/ 762539.0 # => 2.4% faster 
2018-09-11 16:52:44 -05:00
schneems
1bd578ffe6 Don’t allocate array on no args
When no dependencies are present to be digested there is no reason to build an array just to turn around and turn it back into a string.

The dependencies array is not mutated in this method so we can use the same empty array across all invocations.

Total allocated: 791402 bytes (7294 objects)
Total allocated: 777442 bytes (7132 objects)

(791402 - 777442) / 791402.0 # => 1.76 % speed improvement
2018-09-07 17:33:10 -05:00
Ryuta Kamizono
736edb9828 Formatting CHANGELOGs [ci skip]
Fixing code block rendering, indentation, backticks, etc.
2018-09-07 07:59:19 +09:00
schneems
31cfd5e4fd [ci skip] Doc ActionView::OutputBuffer 2018-09-06 15:28:45 -05:00
schneems
a01f4d53b3 [ci skip] Clarify CaptureHelper#capture function 2018-09-06 11:12:55 -05:00
Matthew Draper
068fe7dc90
Merge pull request #33718 from kddeisz/permit-list
Finish converting whitelist and blacklist references
2018-08-29 14:07:37 +09:30