Commit Graph

59278 Commits

Author SHA1 Message Date
Ryuta Kamizono
7db6bd7a23 Revert "sql_for_insert returns values for passing to exec_insert"
This reverts #23067. #23067 is for propagating `pk` value from
`sql_for_insert` to `exec_insert` (avoiding extra query for pg adapter).
Now `exec_insert` includes `sql_for_insert` since #26002 therefore this
propagating is no longer needed.
2016-08-19 12:43:03 +09:00
Rafael Mendonça França
28aaf77bb0
Merge pull request #24099 from k0kubun/preserve-readonly
Preserve readonly flag only for readonly association
2016-08-18 23:17:23 -03:00
Rafael França
085166d59a Merge pull request #26200 from kamipo/remove_unnecessary_ordinal_methods
Remove unnecessary ordinal methods for collection association
2016-08-18 23:14:27 -03:00
Rafael França
c2af081c4f Merge pull request #25999 from kamipo/remove_sanitize_conditions
Remove `sanitize_conditions` and use `sanitize_sql` instead of `sanitize_conditions`
2016-08-18 22:57:27 -03:00
Rafael França
40516d01f1 Merge pull request #26197 from kamipo/remove_unnecessary_test_sql_for_insert_with_returning_disabled
Remove unnecessary `test_sql_for_insert_with_returning_disabled`
2016-08-18 22:56:56 -03:00
Claudio B
47ff483b8b Merge pull request #26214 from philnash/active-job-default-queue
Updates Active Job guide on default runner.
2016-08-18 15:45:02 -07:00
Phil Nash
a0c4bcf651 [ci skip] Updates ActiveJob guide on default runner.
The immediate runner is no longer default, the async adapter is.
2016-08-18 23:00:07 +01:00
Jon Moss
fd0c33d7cc Merge pull request #26193 from iancanderson/ia-document-i18n-required-message
i18n documentation for required belongs_to message
2016-08-17 22:24:01 -04:00
Ryuta Kamizono
592e6b7e89 Remove unnecessary ordinal methods for collection association
Currently `CollectionProxy` inherits `Relation` therefore we can use
its own methods rather than delegating to collection association.
2016-08-18 07:35:16 +09:00
Ian C. Anderson
fbaa5e390f i18n documentation for required belongs_to message
When you don't explicitly provide `optional: true` to a `belongs_to`
definition, rails adds a validation to ensure presence of the
`belongs_to` validation.

However, when the validation is added, it is added with a message key of
`:required`, which was not documented in the "Translations for Active
Record Models" section of the i18n guides.

Here are the lines that add the `:required` message:
c3e3577f9d/activerecord/lib/active_record/associations/builder/belongs_to.rb (L136-L138)

This commit adds the "non-optional association" validation to the table,
so rails users know how to override the message for this validation. The
default message is "must exist".
2016-08-17 18:19:59 -04:00
Ryuta Kamizono
c48630b1ce Remove unnecessary test_sql_for_insert_with_returning_disabled
Because `sql_for_insert` is only called in `use_insert_returning?` is
true since #26002.
2016-08-18 04:51:45 +09:00
Rafael Mendonça França
6568cfd78c
Change method visibility to be private
Those methods are only using inside this module and by a private method
so they all should be private.
2016-08-17 16:15:42 -03:00
Rafael Mendonça França
4c91c44229
Push :defaults extraction down one level
Since e852daa6976cc6b6b28ad0c80a188c06e226df3c only the verb methods
where extracting the defaults options. It was merged a fix for the
`root` method in 31fbbb7faccba25b2e3b5e10b8fca1468579d629 but `match`
was still broken since `:defaults` where not extracted.

This was causing routes defined using `match` and having the `:defaults`
keys to not be recognized.

To fix this it was extracted a new private method with the actual
content of `match` and the `:defaults` extracting was moved to `match`.
2016-08-17 16:09:34 -03:00
Ryuta Kamizono
6eaf5c9253 Deprecate sanitize_conditions. Use sanitize_sql instead
Because `sanitize_conditions` protected method is only used in one place.
2016-08-18 02:00:57 +09:00
Jon Moss
f857e1fd8c Merge pull request #26192 from greenbigfrog/patch-2
Fix #26187
2016-08-17 09:30:56 -04:00
Jonathan
ce17ac2773 Fix #26187
As "discussed" in #26187 I added the route that magically disappeared again.
2016-08-17 15:28:54 +02:00
प्रथमेश Sonpatki
92de2ba8bc Merge pull request #26188 from greenbigfrog/patch-2
Fix diffrent naming in getting_started.md
2016-08-17 16:23:01 +05:30
Jonathan
9233f52bd9 Fix diffrent naming in getting_started.md
I've noticed that once `<h1>Editing article</h1>` L1157 was the title and then later on it's `<h1>Edit article</h1>` L1358 which kind of makes more sense...

[ci skip]
2016-08-17 12:49:56 +02:00
Rafael França
6eee673184 Merge pull request #25396 from kamipo/fix_error_message_for_out_of_range_integer_value
Fix error message for out of range byte size integer value for consistency
2016-08-17 02:58:19 -03:00
Rafael Mendonça França
32e25e812d
Merge pull request #25628 from ysksn/options
Remove parameter "options = nil" for #clear
2016-08-17 02:55:58 -03:00
Guillermo Iguaran
ae739edf4c Merge pull request #26186 from yasulab/fix-link-in-rails5-release-note
Fix link in Rails 5.0 Release Note
2016-08-16 22:49:44 -05:00
Yohei YASUKAWA
d4aec26030
Fix link in Rails 5.0 Release Note [ci skip] 2016-08-17 12:43:52 +09:00
Rafael França
f4b32cdc6c Merge pull request #25976 from kamipo/pluck_uses_loaded_target
`pluck` should use `records` (`load_target`) when `loaded?` is true
2016-08-17 00:35:25 -03:00
Rafael Mendonça França
64bfc5b790
Fix indentation 2016-08-17 00:32:42 -03:00
Rafael Mendonça França
8debad2a18
Merge pull request #25987 from aquajach/master
Fix does_not_support_reverse? to find sql functions with commas in nested brackets
2016-08-17 00:28:56 -03:00
Rafael França
5fe02881b1 Merge pull request #26185 from y-yagi/refactor_commands_tasks
refactor `CommandsTasks`
2016-08-17 00:20:02 -03:00
Rafael França
c1582589f8 Merge pull request #26002 from kamipo/sql_for_insert_should_be_called_inside_exec_insert
`sql_for_insert` should be called inside `exec_insert`
2016-08-17 00:12:31 -03:00
Rafael França
1c9c315e5c Merge pull request #26009 from kamipo/fix_inconsistent_finder_methods_signature
Fix inconsistent the signature of finder methods for collection association
2016-08-17 00:11:34 -03:00
प्रथमेश Sonpatki
da06fb4838 Merge pull request #25862 from prathamesh-sonpatki/start-documenting-ac-testcase-again
Start documenting ActionController::TestCase again
2016-08-17 08:40:12 +05:30
Prathamesh Sonpatki
b556e2b483
Start documenting ActionController::TestCase again
- Rails 5 changed interface for passing arguments to request methods to
  keyword args for AC::TestCase but also hid the documentation.
- But existing AC::TestCase tests need the new documentation about
  keyword args. So resurrected documentation and added a note about not
  using this for new tests.
- The guides and other documentation is already updated to use
  `ActionDispatch::IntegrationTest`.

[Matthew Draper, Prathamesh Sonpatki]
2016-08-17 08:38:53 +05:30
Rafael França
c183761f79 Merge pull request #26021 from kamipo/finder_bang_method_should_call_non_bang_method
Finder bang method should call non bang method
2016-08-17 00:08:34 -03:00
Rafael França
0549f9debf Merge pull request #26037 from monmonmon/master
Check if the logger is not nil before using it
2016-08-17 00:07:35 -03:00
Rafael Mendonça França
7eec1ba604
Merge pull request #26072 from kamipo/extract_case_sensitive_handler
Extract `PredicateBuilder::CaseSensitiveHandler`
2016-08-17 00:00:54 -03:00
yuuji.yaginuma
6e95682b14 refactor CommandsTasks
Extract a common method of `Rails::CommandsTasks` and
`Rails::Engine::CommandsTasks` to the module.
2016-08-17 11:36:39 +09:00
Rafael Mendonça França
2af63c9c9f
Merge pull request #26121 from MaxLap/fix_count_with_left_joins
Fix count which would sometimes force a DISTINCT
2016-08-16 23:13:42 -03:00
Rafael França
af4dfa9e1a Merge pull request #25671 from kamipo/dont_handle_as_associated_predicate_if_table_has_column
Do not handle as an associated predicate if a table has the column
2016-08-16 23:10:53 -03:00
Rafael França
12a42f79ad Merge pull request #26000 from kamipo/remove_sanitize
Remove internal `sanitize` method
2016-08-16 22:54:43 -03:00
David Heinemeier Hansson
a1e4c197cb Yield the job instance so you have access to things like job.arguments on the custom logic after retries fail 2016-08-16 16:01:59 -07:00
Rafael França
e1aabeedd8 Merge pull request #25863 from mechanicles/remove-duplicate-test
Remove duplicate test.
2016-08-16 14:58:06 -03:00
Rafael França
149c144409 Merge pull request #26183 from Shopify/fix-no-touching-touch-later
Makes touch_later respects no_touching policy
2016-08-16 12:57:55 -03:00
Ryuta Kamizono
9d0088840c Finder bang method should call non bang method
Otherwise CollectionProxy's bang methdos cannot respect dirty target.
2016-08-16 22:50:41 +09:00
Ryuta Kamizono
46380674d3 Fix inconsistent the signature of finder methods for collection association
`#second`, `#third`, etc finder methods was added in 03855e790de2224519f55382e3c32118be31eeff.
But the signature of these methods is inconsistent with the original
finder methods. And also the signature of `#first` and `#last` methods
is different from the original. This commit fixes the inconsistency.
2016-08-16 22:46:59 +09:00
Maxime Lapointe
0aae7806c1 Fix count which would sometimes force a DISTINCT
The current behaviour of checking if there is a LEFT OUTER JOIN arel
node to detect if we are doing eager_loading is wrong. This problem
wasn't frequent before as only some pretty specific cases would add
a LEFT OUTER JOIN arel node. However, the recent new feature
left_outer_joins also add this node and made this problem happen
frequently.

Since in the perform_calculation function, we don't have access to
eager_loading information, I had to extract the logic for the distinct
out to the calculate method.

As I was in the file for left_outer_join tests, I fixed a few that had
bugs and I replaced some that were really weak with something that
will catch more issues.

In relation tests, the first test I changed would have failed if it
had validated the hash returned by count instead of just checking how
many pairs were in it. This is because this merge of join currently
transforms the join node into an outer join node, which then made
count do a distinct. So before this change, the return was
{1=>1, 4=>1, 5=>1}.
2016-08-16 09:45:23 -04:00
Jean Boussier
ed34b67607 Makes touch_later respects no_touching policy 2016-08-16 15:20:50 +02:00
Rafael França
82ec6b3606 Merge pull request #26061 from malclocke/specify_ar_message_interpolation_names_in_i18n_guide
List names of error interpolation variables.
2016-08-16 07:03:16 -03:00
Ryuta Kamizono
3a1f6fe7b4 Extract PredicateBuilder::CaseSensitiveHandler
Currently uniqueness validator is coupled with building Arel ASTs.
This commit extracts `PredicateBuilder::CaseSensitiveHandler` for
decouple the building Arel ASTs.
2016-08-16 19:02:02 +09:00
Rafael França
05a35b5b63 Merge pull request #26175 from stomar/upgrade-guide-fix
Clarify migration to ApplicationRecord in upgrade guides [ci skip]
2016-08-16 06:56:22 -03:00
Ryuta Kamizono
c6a62dc327 Do not handle as an associated predicate if a table has the column
If handled as an associated predicate even though a table has the
column, will generate invalid SQL by valid column name treated as a
table name.
2016-08-16 18:47:16 +09:00
Rafael França
c6900ce1bb Merge pull request #26181 from oss92/add-column-array-docs
Add array column documentation
2016-08-16 06:40:33 -03:00
Rafael França
d24f31adb8 Merge pull request #26094 from igorkasyanchuk/master
Show unpermitted parameters as symbols in logs (so they could be copy…
2016-08-16 06:35:01 -03:00