| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's often the case that you want to have an option that you cannot
specify at the database level, but want applied to *all* tables that you
create. For example, you might want to specify `ROW_FORMAT=DYNAMIC` to
not have to limit text columns to length 171 for indexing when using
utf8mb4. This allows an easy way to specify this in your database
configuration.
While this change affects both MySQL and MySQL2, the test only covers
MySQL2, as the legacy mysql adapter appears to always return ASCII
strings, and is tangential to what we're actually doing.
|
|\
| |
| | |
Change Enumerable#sum to use inject(:sym) specification
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Not only does this make for simpler, more obvious code, it's also more performant:
require 'benchmark/ips'
module Enumerable
def old_sum(identity = 0, &block)
if block_given?
map(&block).old_sum(identity)
else
inject { |sum, element| sum + element } || identity
end
end
def new_sum(identity = 0, &block)
if block_given?
map(&block).new_sum(identity)
else
inject(:+) || identity
end
end
end
summable = (1..100).to_a # sum is 5050
Benchmark.ips do |x|
x.report("old_sum") { summable.old_sum }
x.report("new_sum") { summable.new_sum }
x.compare!
end
# Calculating -------------------------------------
# old_sum 10.674k i/100ms
# new_sum 14.542k i/100ms
# -------------------------------------------------
# old_sum 117.350k (± 7.1%) i/s - 587.070k
# new_sum 154.712k (± 3.8%) i/s - 785.268k
#
# Comparison:
# new_sum: 154712.1 i/s
# old_sum: 117350.0 i/s - 1.32x slower
More benchmarks [here](https://gist.github.com/tjschuck/b3fe4e8c812712376648), including summing strings and passing blocks. The performance gains are less for those, but this version still always wins.
|
|\ \
| | |
| | | |
Change configuration-guide example [ci skip]
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Use an example from a default Rails app (4.2.5) rather than an outdated one in the Configuring Rails Components section.
I picked config.time_zone as it currently is the only 'setting for Rails' left in a default config/application.rb.
I stumbled upon this with investigating autoloading in a legacy app, which still included the example comment "# config.autoload_paths += %W(#{config.root}/extras)". Usually adding app/* directories to autoload_paths isn't necessary, so also finding this example within the current docs was a bit confusing initially.
[ci skip]
|
|\ \ \
| | | |
| | | | |
Fix a typo [ci skip]
|
|/ / / |
|
|\ \ \
| |/ /
|/| | |
Remove newlines from start of logs
|
| | |
| | |
| | |
| | |
| | |
| | | |
Currently if using a single line logger, this causes the time stamp and
log message to be on separate lines which is not common to how most
other logging works.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
[ci skip]
Since the "Getting Started" guide no longer uses the scaffold generator
we should rewrite references to that in the testing guide.
The functional testing section was quite heavily based on such a
scaffold test. I changed it to use `generate scaffold_controller`
instead so that we can build up on the model foundation we already have.
|
|\ \ \
| | | |
| | | | |
[ci skip] Indentation in API app guide
|
|/ / / |
|
| |/
|/|
| |
| | |
Fixes #22311
|
|\ \
| | |
| | | |
Rename 'key' to 'lock_id' or 'lock_name' for advisory locking
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- key was a poor choice of name. A key implies something that will
unlock a lock. The concept is actually more like a 'lock identifier'
- mysql documentation calls this a 'lock name'
- postgres documentation calls it a 'lock_id'
- Updated variable names to reflect the preferred terminology for the database in
question
|
|/ /
| |
| |
| |
| |
| |
| | |
This reverts commit 16ce41b7f4449d6df15df30d69aef18da6510f36.
Reason: See
https://github.com/rails/rails/commit/16ce41b7f4449d6df15df30d69aef18da6510f36#commitcomment-14475125
|
|\ \
| | |
| | | |
Use latest byebug
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Fixed a few grammar issues.
|
|/ / |
|
|\ \
| | |
| | | |
[ci skip] fix inconsistent indentation
|
|/ / |
|
| | |
|
|\ \
| | |
| | | |
[ci skip] Add CHANGELOG for #22300 (817c1825c15013fd0180762ac5c05a2e0…
|
| | | |
|
|/ /
| |
| |
| |
| |
| | |
In b71e08f we started raising when nil or false was passed to merge to
fix #12264, however we should also do this for truthy values that are
invalid like true.
|
|\ \
| | |
| | |
| | |
| | |
| | | |
timbreitkreutz/twb-9015-schema-dumper-test-for-prefix-and-ignore
Test case for Issue #9015 - ignore_table and table_prefix at same time
|
| | | |
|
|\ \ \
| | | |
| | | | |
Make `AR::SpawnMethods#merge!` to check an arg is a Proc
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
From Ruby ( 2.3.0dev trunk 52520), `Hash#to_proc` is defined
(https://github.com/ruby/ruby/commit/fbe967ec02cb65a7efa3fb8f3d747cf6f620dde1),
and many tests have been failed with
`ArgumentError: wrong number of arguments (given 0, expected 1)`.
Because we call `Hash#to_proc` with no args in `#merge!`.
This commit changes order of conditionals to not call `Hash#to_proc`.
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
send normalized keys to the cache backends so they do not need to man…
|
| | | | | |
|
| |/ / /
| | | |
| | | |
| | | | |
this themselves
|
|\ \ \ \
| | | | |
| | | | | |
Except keys of `build_record`'s argument from `create_scope` in initi…
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
initialize_attributes
If argument of `build_record` has key and value which is same as
default value of database, we should also except the key from
`create_scope` in `initialize_attributes`.
Because at first `build_record` initialize record object with argument
of `build_record`, then assign attributes derived from Association's scope.
In this case `record.changed` does not include the key, which value is
same as default value of database, so we should add the key to except list.
Fix #21893.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Use proper syntax for class method reference in changelog
|
|/ / / / / |
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
yuki24/make-static-index-part-of-public-file-server-config
Make the `config.static_index` option part of the `config.public_server` option
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Also call it `public_server.index_name` so it'll make more sense.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
kamipo/remove_not_needed_native_database_types_entries
Remove not needed `NATIVE_DATABASE_TYPES` entries
|
| | |/ / / /
| |/| | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The string returned here will ultimately get used as a key of a hash in
the attribute set once the attributes are being built. When you give a
non-frozen string to `Hash#[]`, it will be duped. Be freezing we can
significantly reduce the number of times we end up allocating
`"user_id"`
This does not include any additional tests, as this should not have any
public facing implications. If you are mutating the result of
`Reflection#foreign_key`, please stop.
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|
| | | | | | |
|