Akira Matsuda
a1d7d4c6dc
Reduce Hash object creation when normalizing request env
2019-07-31 11:51:59 +09:00
Akira Matsuda
05060ddba1
Cache tags_text to avoid computing tags each time when logging
2019-07-31 11:51:59 +09:00
Akira Matsuda
b8d29f35f0
Reduce object allocations in Middleware::Static
2019-07-31 11:51:59 +09:00
Akira Matsuda
f915341628
Reduce unnecessary String creation by not `to_s`ing until nothing matches
2019-07-31 11:51:19 +09:00
Akira Matsuda
303f388d93
Reduce String allocation when finding controller class
2019-07-31 11:51:19 +09:00
Akira Matsuda
23009e3e33
No need to dup the payload for an instrumentation
2019-07-31 11:51:19 +09:00
Akira Matsuda
79520879e9
Speedup and reduce Array creation when constantizing a non-namespaced string
2019-07-31 11:51:19 +09:00
Ryuta Kamizono
7195455561
Merge pull request #36815 from emp823/master
...
Fix typo in autoload documentation [ci skip]
2019-07-31 01:54:39 +09:00
Erik Pearson
fab42177c1
Fix typo in autoload documentation [ci skip]
2019-07-30 12:39:51 -04:00
Javan Makhmali
aa00aec32a
Bump Trix to ^1.2.0
...
Adds an attachment button to the Trix toolbar that improves overall file upload usability, especially on mobile devices where files can't be dragged / dropped.
References:
- https://github.com/basecamp/trix/releases/tag/1.2.0
- https://github.com/basecamp/trix/pull/619
- https://github.com/basecamp/trix/issues/582
2019-07-30 10:12:14 -04:00
Prem Sichanugrist
004f223f33
Merge pull request #36813 from haruyuki97/haruyuki97/fix-comment-in-url-helper
...
Fix a/an usage on `phone_to` documentation.
[ci skip]
2019-07-30 18:59:31 +09:00
Prem Sichanugrist
bd822a45be
Merge pull request #36812 from nigh7m4r3/readme-comma-usage
...
Fix comma usage on project's README.md
[ci skip]
2019-07-30 18:58:14 +09:00
haruyuki97
96e8a817fa
fix a typo [ci skip]
2019-07-30 18:49:25 +09:00
Rifatul Islam Chayon
56b3f79254
Update README.md
...
A very minor change of comma usage.
2019-07-30 13:39:14 +06:00
Ryuta Kamizono
1e5c0a7836
Merge pull request #36805 from kamipo/user_supplied_joins_order_should_be_preserved
...
Preserve user supplied joins order as much as possible
2019-07-30 12:39:50 +09:00
Ryuta Kamizono
fff120c752
Add `silence_warnings` for defining 'not_' prefix enum elements
...
To suppress the following warnings in tests.
```
~/rails/activerecord/lib/active_record/scoping/named.rb:190: warning: method redefined; discarding old not_sent
~/rails/activerecord/lib/active_record/scoping/named.rb:190: warning: previous definition of not_sent was here
```
2019-07-30 04:54:55 +09:00
Ryuta Kamizono
b4478ae8bc
Preserve user supplied joins order as much as possible
...
Currently, string joins are always applied as last joins part, and Arel
join nodes are always applied as leading joins part (since #36304 ), it
makes people struggled to preserve user supplied joins order.
To mitigate this problem, preserve the order of string joins and Arel
join nodes either before or after of association joins.
Fixes #36761 .
Fixes #34328 .
Fixes #24281 .
Fixes #12953 .
2019-07-30 04:02:58 +09:00
Vipul A M
8d2e75e84c
Merge pull request #36804 from vzvu3k6k/tt
...
[ci skip] Fix unclosed tags in `Inflector` docs
2019-07-30 02:37:28 +08:00
vzvu3k6k
515238bc6c
[ci skip] Fix unclosed tags in `Inflector` docs
2019-07-30 03:18:05 +09:00
John Hawthorn
8b0b591296
Merge pull request #36782 from jhawthorn/move_database_exists_to_adapter
...
Move DatabaseAlreadyExists detection to DB adapter
2019-07-29 11:06:27 -07:00
Ryuta Kamizono
e0b19a3622
Expand CHANGELOG for #36800 [ci skip]
2019-07-30 02:50:11 +09:00
John Hawthorn
69700c9ee7
Move DatabaseAlreadyExists detection to DB adapter
...
Previously it was the responsibility of the database tasks to translate
the invalid statement from creating a duplicate database into an
ActiveRecord::Tasks::DatabaseAlreadyExists error.
It's actually easier for us to do this detection inside of the adapter,
where we already do a case statement on the return code to translate the
error.
This commit introduces ActiveRecord::DatabaseAlreadyExists, a subclass
of StatementInvalid, and updates both AbstractMysqlAdapter and
PostgresqlAdapter to return this more specific exception in that case.
Because this is a subclass of the old exception, StatementInvalid, it
should be backwards compatible with any code expecting that from
create_database.
This works for both create_database and exectute("CREATE DATABASE")
2019-07-29 08:40:57 -07:00
Carlos Antonio da Silva
17b8cde6d1
Call raise with parentheses like a normal method call with arguments
...
Using `(raise FooError, "error")` is like forcing a "new scope" around
the `raise` call, it's simpler to just wrap the `raise` arguments with
parentheses just like any other method call would.
2019-07-29 12:28:36 -03:00
Ryuta Kamizono
2e6d9af6c8
Merge pull request #36800 from jamespearson/matches_regex_mysql
...
Enabled matches_regex for MySql
2019-07-30 00:08:27 +09:00
James Pearson
92c265b3ad
Enabled matches_regex for MySql
...
Previously matches_regex was only availble on PostgreSql, this will enable it for MySql
Usage example:
users = User.arel_table;
users = User.arel_table; User.where(users[:email].matches_regexp('(.*)\@gmail.com'))
Update activerecord/test/cases/arel/visitors/mysql_test.rb
Co-Authored-By: Ryuta Kamizono <kamipo@gmail.com>
2019-07-29 15:53:29 +01:00
Ryuta Kamizono
79740de065
Merge pull request #36198 from oneiros/actionmailer_ssl_option
...
Documentation for ActionMailer's SMTP over SSL/TLS option
[ci skip]
2019-07-29 23:30:35 +09:00
David Roetzel
1480b87f31
Improve documentation of `:ssl/:tls` option [ci skip]
...
Add missing bullet point to make clear this is
actually a separate option from
`:openssl_verify_mode`.
Add `:ssl/:tls`-option to guides as well [ci skip]
2019-07-29 15:42:32 +02:00
Robin Dupret
682f664819
Tiny documentation fix [ci skip]
2019-07-29 12:42:24 +02:00
Ryuta Kamizono
36c5a74988
Merge pull request #36798 from meganemura/remove-redundant-empty-line
...
Remove redundant empty line when we don't use system test
2019-07-29 19:34:14 +09:00
meganemura
718c9e5e7f
Remove redundant empty line when we don't use system test
2019-07-29 19:11:27 +09:00
Akira Matsuda
0196551e60
Use match? where we don't need MatchData
2019-07-29 14:23:10 +09:00
Akira Matsuda
0d981a2b3d
Let the generated initializers/backtrace_silencers.rb code use Regexp#match?
2019-07-29 14:21:30 +09:00
Akira Matsuda
26edd1d112
Revert "Use assert_match / assert_no_match for asserting match"
...
This reverts commit e9651deea4
.
Now we're having both `=~` and `match?` for these objects, and it's nicer to have explicit tests for both of them
2019-07-29 14:17:36 +09:00
Akira Matsuda
8f90ac7827
Add AS::TimeZone#match?
2019-07-29 14:17:36 +09:00
Akira Matsuda
381e8cb67a
Add AS::Multibyte::Chars#match?
2019-07-29 14:17:36 +09:00
Akira Matsuda
d55dea5ef1
Add Mime::Type#match? that doesn't create MatchData
2019-07-29 14:17:36 +09:00
Akira Matsuda
62d089a4ad
Suppress Ruby warning: ⚠️ non-nil $, will be deprecated
2019-07-29 12:55:28 +09:00
Rafael França
d880faeefb
Merge pull request #36031 from st0012/guard-35982
...
Add test case to guard the query count for relation cache (for #35982 )
2019-07-28 22:11:46 -04:00
Lachlan Campbell
f1cfe1ee70
Add viewport meta tag to default application template
2019-07-28 19:49:53 -04:00
Xavier Noria
bfc9065d58
Improves compatibility of require_dependency in zeitwerk mode [ Closes #36774 ]
...
Applications are not supposed to use require_dependency in their own
code if running in zeitwerk mode, and require_dependency was initially
aliased to require with that use case in mind.
However, there are situations in which you cannot control the mode and
need to be compatible with both. There, you might need require_dependency
in case you are being executed in classic mode. Think about engines that
want to support both modes in their parent applications, for example.
Furthermore, Rails itself loads helpers using require_dependency.
Therefore, we need better compatibility.
2019-07-28 14:09:01 +02:00
Ryuta Kamizono
71e41a5b94
Performance improvement for `String#to`
...
```ruby
class String
def to1(position)
position = [position + length, -1].max if position < 0
self[0, position + 1]
end
def to2(position)
position += size if position < 0
self[0, position + 1] || +""
end
end
Benchmark.ips do |x|
x.report("'foo'.to(1)") { 'foo'.to(1) }
x.report("'foo'.to1(1)") { 'foo'.to1(1) }
x.report("'foo'.to2(1)") { 'foo'.to2(1) }
x.report("'foo'.to(-1)") { 'foo'.to(-1) }
x.report("'foo'.to1(-1)") { 'foo'.to1(-1) }
x.report("'foo'.to2(-1)") { 'foo'.to2(-1) }
x.report("'foo'.to(-10)") { 'foo'.to(-10) }
x.report("'foo'.to1(-10)") { 'foo'.to1(-10) }
x.report("'foo'.to2(-10)") { 'foo'.to2(-10) }
end
```
Result:
```
Warming up --------------------------------------
'foo'.to(1) 199.859k i/100ms
'foo'.to1(1) 220.293k i/100ms
'foo'.to2(1) 221.522k i/100ms
'foo'.to(-1) 205.032k i/100ms
'foo'.to1(-1) 195.837k i/100ms
'foo'.to2(-1) 214.975k i/100ms
'foo'.to(-10) 214.331k i/100ms
'foo'.to1(-10) 182.666k i/100ms
'foo'.to2(-10) 224.696k i/100ms
Calculating -------------------------------------
'foo'.to(1) 4.685M (± 4.2%) i/s - 23.583M in 5.042568s
'foo'.to1(1) 5.233M (± 5.8%) i/s - 26.215M in 5.026778s
'foo'.to2(1) 5.180M (± 5.7%) i/s - 25.918M in 5.020735s
'foo'.to(-1) 4.253M (± 7.0%) i/s - 21.323M in 5.043133s
'foo'.to1(-1) 4.438M (±11.2%) i/s - 21.934M in 5.025751s
'foo'.to2(-1) 4.716M (± 9.8%) i/s - 23.432M in 5.028088s
'foo'.to(-10) 4.678M (± 9.5%) i/s - 23.148M in 5.007379s
'foo'.to1(-10) 4.428M (± 5.1%) i/s - 22.103M in 5.005155s
'foo'.to2(-10) 5.243M (± 4.6%) i/s - 26.289M in 5.024695s
```
2019-07-28 17:16:03 +09:00
Ryuta Kamizono
715dad107b
Merge pull request #36787 from st0012/refactor-sql-tests
...
Use capture_sql helper method in tests
2019-07-28 16:34:24 +09:00
Ryuta Kamizono
36b32bb32e
Revert "Merge pull request #36785 from shes50103/fix_typo_actionpack_changelog"
...
This reverts commit ac6f3c9299
, reversing
changes made to 5b0ea95a1a
.
2019-07-28 15:55:38 +09:00
st0012
6fbf52d580
Use capture_sql helper method in tests
2019-07-28 14:47:57 +08:00
st0012
e289c8d775
Assert query counts in cache relation test
...
This is to guard the change in #35982
2019-07-28 14:24:47 +08:00
Rafael França
49238eaf8c
Merge pull request #36185 from jonathanhefner/optimize-string-first-and-last
...
Improve String#first and #last performance
2019-07-28 00:02:33 -04:00
Rafael França
ac6f3c9299
Merge pull request #36785 from shes50103/fix_typo_actionpack_changelog
...
fix typo in actionpack CHANGELOG.md
2019-07-27 23:42:43 -04:00
shes50103
c3d5c9447a
fix typo in actionpack CHANGELOG.md
2019-07-28 11:17:19 +08:00
Rafael Mendonça França
5b0ea95a1a
Merge pull request #36545 from tomfakes/screenshot-updates
...
HTML page save during screenshot and multiple shots per test
2019-07-27 22:48:24 -04:00
Rafael França
481714dd06
Merge pull request #36303 from gaotongfei/feature/ignore-specified-fixtures
...
Allow specifying fixtures to be ignored in "_fixture" section
2019-07-27 21:12:06 -04:00