Commit Graph

63206 Commits

Author SHA1 Message Date
प्रथमेश Sonpatki
b6300f3ecc Added time helper method freeze_time which is an alias for travel_to Time.now (#29681) 2017-07-10 12:13:37 +02:00
Kasper Timm Hansen
a35f08f038 Merge pull request #29735 from y-yagi/make_sidekiq_and_resque_integration_tests_work_in_ci
Make sidekiq and resque integration tests work in CI
2017-07-10 09:18:14 +02:00
yuuji.yaginuma
46725b33a9 Make sidekiq and resque integration tests work in CI
Since f55ecc6, the integration test of sidekiq and resque is not working
in CI.
https://travis-ci.org/rails/rails/jobs/251783876

Because f55ecc6 required a password to access redis.
Therefore, handling by passing passwords when connecting to redis.
2017-07-10 07:42:17 +09:00
Matthew Draper
92be910f6a Merge pull request #29733 from kirs/frozen-activejob
Use frozen-string-literal in ActiveJob
2017-07-10 04:59:49 +09:30
Kir Shatrov
14ece5e429 Use frozen-string-literal in ActiveJob 2017-07-09 20:50:52 +03:00
Kasper Timm Hansen
0b6309d6bc Merge pull request #29731 from castrodd/patch-1
[ci skip] Updated language on validations.
2017-07-09 18:27:44 +02:00
Kasper Timm Hansen
85d154f052 Merge pull request #29730 from bdewater/update-encryptor-docs
Update MessageEncryptor example to use dynamic key length
2017-07-09 18:24:12 +02:00
Daniel Castro
4f7b7c9879 [ci skip] Updated language on validations. 2017-07-09 12:15:56 -04:00
Bart de Water
062283d9d3 [ci skip] update MessageEncryptor example to use the key length as returned by OpenSSL 2017-07-09 11:17:47 -04:00
Kasper Timm Hansen
b362ce6d54 Merge pull request #29721 from y-yagi/fix_29696
Treat secrets as binary
2017-07-09 17:08:49 +02:00
Kasper Timm Hansen
bed328c888 Merge pull request #29725 from y-yagi/fix_29717
Load environment file in `dbconsole` command
2017-07-09 17:00:22 +02:00
Matthew Draper
551f88366d Merge pull request #29655 from kirs/frozen-friendly-ap-ar
Prepare AP and AR to be frozen string friendly
2017-07-10 00:07:03 +09:30
Matthew Draper
8d98bb0cc6 Merge pull request #29728 from kirs/frozen-activesupport
Use frozen-string-literal in ActiveSupport
2017-07-09 22:58:40 +09:30
Kir Shatrov
72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
yuuji.yaginuma
e12715bfd5 Load environment file in dbconsole command
Currently the environment file is not loaded in `dbconsole` command.
Therefore, for example, if use encrypted secrets values in database.yml,
`read_encrypted_secrets` will not be true, so the value can not be
used correctly.

Fixes #29717
2017-07-09 13:18:56 +09:00
yuuji.yaginuma
be4ebc4780 Treat secrets as binary
Until Rails 5.1.1 secrets was treated as binary inside Rails.
https://github.com/rails/rails/blob/v5.1.1/railties/lib/rails/secrets.rb#L59
https://github.com/rails/rails/blob/v5.1.1/railties/lib/rails/secrets.rb#L63

However, it is treated as String in Rails 5.1.2(changed by 157db872103429e8782b62d1cb5d1d91337177a7).
https://github.com/rails/rails/blob/v5.1.2/railties/lib/rails/secrets.rb#L104
https://github.com/rails/rails/blob/v5.1.2/railties/lib/rails/secrets.rb#L108

As a result, when upgrading from Rails 5.1.1 to 5.1.2, to write the value
treated as binary using `File.write`, causing an error.

In order to avoid `UndefinedConversionError`, fixed it to treat it as
binary like 5.1.1.
Fixes #29696
2017-07-09 09:25:45 +09:00
Matthew Draper
650ea5e5cf Merge pull request #29715 from reverbdotcom/ptd/fix-invalid-uuids
Don't allow uuids with orphan curly braces
2017-07-09 07:59:44 +09:30
Ryuta Kamizono
72e1c4229a Add backticks [ci skip] 2017-07-09 04:15:53 +09:00
Matthew Draper
b83852e6ee Merge pull request #28867 from eugeneius/skip_query_cache_in_batches
Skip query cache for in_batches and friends
2017-07-09 04:29:28 +09:30
Matthew Draper
e5bcc7b53c Merge pull request #29692 from fimmtiu/avoid-translating-non-database-exceptions
Don't translate non-database exceptions.
2017-07-09 04:14:48 +09:30
Matthew Draper
40a20ded01 Merge pull request #29297 from palkan/fix/action-cable-postgres-identifiers-limit
Fix bug with long stream identifiers when using Postgres adapter
2017-07-09 03:30:13 +09:30
Matthew Draper
5c17e34946 Merge pull request #29495 from eugeneius/_write_attribute
Improve the performance of writing attributes
2017-07-09 03:07:08 +09:30
Matthew Draper
1990c8f9b6 Merge pull request #29695 from y-yagi/secrets_show
Add `rails secrets:show` command
2017-07-09 03:04:19 +09:30
Matthew Draper
7147e52455 Merge pull request #29705 from y-yagi/do_not_update_secrets_yml_enc
Do not update `secrets.yml.enc` when secretes do not change
2017-07-09 03:00:56 +09:30
Matthew Draper
8fdc166e56 Merge pull request #29706 from kamipo/use_information_schema_to_extract_expression
Use `information_schema` to extract `generation_expression` for MariaDB
2017-07-09 02:58:56 +09:30
Matthew Draper
fac5fe09d3 Merge pull request #29708 from kamipo/fix_current_timestamp_for_mariadb
Fix default `CURRENT_TIMESTAMP` in schema dumping for MariaDB 10.2
2017-07-09 02:50:07 +09:30
Richard Schneeman
a41f3305e6 Merge pull request #29718 from ragesoss/master
Clarify i18n guide for how pluralization rules work by default
2017-07-08 12:08:18 -04:00
eileencodes
91d22b7832 Don't call register on custom drivers
It's possible for developers toadd a custom driver and then call it
using `driven_by`. Because we were only skipping `register` for
`:rack_test` that meant any custom driver would attempt to be registered
as well.

The three listed here are special because Rails registers them with
special options. If you're registering your own custom driver then you
don't want to separately register that driver.

Fixes #29688
2017-07-08 11:13:28 -04:00
Eileen M. Uchitelle
a136c291ed Merge pull request #29680 from koic/update_default_app_files_in_app_generator_test
Update default app files in app_generator_test
2017-07-08 10:35:35 -04:00
Sage Ross
6a8d618b59 Clarify i18n guide for how pluralization rules work by default
The guide misleadingly indicates that the I18n gem will apply the CLDR pluralization rules for each language. This is not the case; only the English algorithm, with support for :zero, :one, and :other, is available by default. Locale-specific pluralization rules require additional configuration and must be supplied by the application (or by another gem).
2017-07-07 23:10:23 -07:00
pdebelak
38b041713b Don't allow uuids with orphan curly braces
The uuid validation regex was allowing uuids to have a single leading
curly brace or single trailing curly brace. Saving with such a uuid
would cause Postgres to generate an exception even though the record
seemed valid. With this change, the regex requires both a leading *and*
a trailing curly brace or neither to be valid.
2017-07-07 16:19:56 -05:00
Rafael França
98f8f81879 Merge pull request #29714 from jahfer/implement-errors-merge
Add ActiveModel::Errors#merge!
2017-07-07 16:21:05 -04:00
Rafael Mendonça França
44f3ecbe5f Test thor master 2017-07-07 15:16:39 -04:00
Jahfer Husain
3650ca983c Add ActiveModel::Errors#merge!
ActiveModel::Errors#merge! allows ActiveModel::Errors to append errors from
a separate ActiveModel::Errors instance onto their own.

Example:

    person = Person.new
    person.errors.add(:name, :blank)

    errors = ActiveModel::Errors.new(Person.new)
    errors.add(:name, :invalid)

    person.errors.merge!(errors)
    puts person.errors.messages
    # => { name: ["can't be blank", "is invalid"] }
2017-07-07 14:32:59 -04:00
Dennis Taylor
8219e17763 Remove driver-specific hard-coding in the tests. 2017-07-07 11:28:47 -07:00
Dennis Taylor
79c8fa7c64 Rename the StatementInvalid test method for clarity. 2017-07-07 11:28:17 -07:00
Dennis Taylor
e45226dd89 Fix changelog wording as suggested. 2017-07-07 11:27:46 -07:00
yuuji.yaginuma
32327eb123 Do not update secrets.yml.enc when secretes do not change
Currently, if open a file with `secrets:edit` command, `secrets.yml.enc`
will be changed even if its contents do not change.

Therefore, even if only want to check secrets, the difference will come
out. This is a little inconvenient.

As a fix to the above problem, when content does not change,
`secrets.yml.ecn` is fixed so that it is not changed.
2017-07-07 12:16:53 +09:00
Ryuta Kamizono
80cbf27f9e Fix default CURRENT_TIMESTAMP in schema dumping for MariaDB 10.2
Since MariaDB 10.2, `CURRENT_TIMESTAMP` is shown as a function
(`current_timestamp()`). Fix matching column default to address that
case.

Fixes #29698.
2017-07-07 10:35:53 +09:00
Ryuta Kamizono
f4e2807a1a Use information_schema to extract generation_expression for MariaDB
Since MariaDB 10.2.5, `information_schema` supports Virtual Columns.

Fixes #29670.
2017-07-07 09:32:01 +09:00
Eugene Kenny
dff37ff613 Rename raw_write_attribute to write_attribute_without_type_cast
This name more accurately describes what the method does, and also
disambiguates it from `_write_attribute`, which ignores aliases.

We can also make the method private, since it's not public API and only
called from one place - `update_columns` - without an explicit receiver.
2017-07-07 00:53:02 +01:00
Jeremy Daer
c9b514cd3e Merge pull request #29704 from kamipo/fix_mariadb_version
Fix extracting MariaDB version
2017-07-06 16:36:14 -07:00
yuuji.yaginuma
af5368eeff Add rails secrets:show command
When secrets confirmed with the `secrets:edit` command, `secrets.yml.enc`
will change without updating the secrets.

Therefore, even if only want to check secrets, the difference will come
out. This is a little inconvenient.

In order to solve this problem, added the `secrets:show` command.
If just want to check secrets, no difference will occur use this command.
2017-07-07 07:22:01 +09:00
Ryuta Kamizono
3b1caef68f Fix extracting MariaDB version
Currently `version` method always returns `5.5.5` because the
`full_version` is `5.5.5-10.x.y-MariaDB...` since MariaDB 10.x.
It should be ignored if the prefix is `5.5.5-`.
2017-07-07 07:09:31 +09:00
Kir Shatrov
b3f3d49fd6 Prepare AP and AR to be frozen string friendly 2017-07-06 21:30:43 +03:00
Dennis Taylor
6b7347b124 Use StandardError instead of RuntimeError.
Whoops.
2017-07-06 10:33:36 -07:00
palkan
2bce7777b7 [Fix #28751] Hash stream long stream identifiers when using Postgres adapter 2017-07-06 17:34:05 +03:00
Eugene Kenny
6658e3746b Skip query cache for in_batches and friends
The `find_each`, `find_in_batches` and `in_batches` APIs usually operate
on large numbers of records, where it's preferable not to load them all
into memory at once.

If the query cache is enabled, it will hold onto the query results until
the end of the execution context (request/job), which means the memory
used is still proportional to the total number of records. These queries
are typically not repeated, so the query cache isn't desirable here.
2017-07-06 14:21:07 +01:00
Dennis Taylor
06e89c922c Fix indentation style for private method. 2017-07-05 17:13:37 -07:00
Dennis Taylor
ad0bde58d4 Don't translate non-database exceptions.
The AbstractAdapter will translate all StandardErrors generated during the course of a query into ActiveRecord::StatementInvalids. Unfortunately, it'll also mangle non-database-related errors generated in ActiveSupport::Notification callbacks after the query has successfully completed. This should prevent it from translating errors from ActiveSupport::Notifications.
2017-07-05 17:02:59 -07:00