Commit Graph

53968 Commits

Author SHA1 Message Date
Sean Griffin
35085c9540 Deprecate HWIDA.new_from_hash_copying_default
This method was already niche, and is now redundant with `.new`
2015-10-29 10:01:33 -06:00
Sean Griffin
ddb886ef13 Merge pull request #16357 from gchan/hwia-respects-to-hash-default
`HashWithIndifferentAccess.new` respects the default value or proc on
objects that respond to `#to_hash`
2015-10-29 09:54:55 -06:00
Sean Griffin
90dbfdcba2 Merge pull request #19501 from ccutrer/dry_sti_subclass_finding2
DRY up STI subclass logic
2015-10-29 09:43:12 -06:00
Sean Griffin
b8832c1b54 Fix a stylistic nitpick in #19501
We don't need to use `String#+` or create all the intermediate strings
to break a string into multiple lines. We can just write a c-style
multiline string literal. This is by no means a hotpath, but this is
clearer to me anyway.
2015-10-29 09:42:24 -06:00
Sean Griffin
42b9f3eb52 Fix test failures caused by #19501
The first one is quite straightforward. We want to give the proper error
message in the case where a top level constant exists, but we're looking
for a nested one. We just need to port over the change to use
`subclass.name` into these changes.

The second set of failures, which are only present in the mysql adapter
tests, are stranger to me. The failure occurs because we were
previously comparing `subclass.name == self.name` instead of `subclass
== self`. However, I don't think that we need to support creating
anonymous classes which share a table with a class that uses STI,
overrides `name` to return the same name as athe class that we have no
other relationship with, when not assigned to a constant so it could
never be used anyway...

The commits around why that exist give no context, and I think they're
just poorly written tests (WTF does `test_schema` mean anyway, and why
does calling `.first` on some anonymous class test it?). We'll just
disable STI on that class.
2015-10-29 09:37:13 -06:00
Yves Senn
6dc6a0b17c Merge pull request #22026 from akihiro17/fix-preload-association
Set `scope.reordering_value` to `true` if :reordering values aren't nil
2015-10-29 16:30:08 +01:00
Yves Senn
ec94f00ba3 Merge pull request #22116 from gsamokovarov/fix-form-for-block-test
Fix a faulty form_for test
2015-10-29 16:22:47 +01:00
Sean Griffin
4a2d586cfc Fix merge conflicts from #19501
I'm making this commit separately because this has failing tests and
style nitpicks that I'd like to make as individual commits, to make the
changes I'm making explicit.

We still want a single merge commit at the end, however.
2015-10-29 09:22:45 -06:00
akihiro17
0fdc2dbe6f Set scope.reordering_value to true if :reordering values are specified
We should call `scope.order!` and set `scope.reordering_value` to `true` if :reordering values are specified

Fixes #21886
2015-10-30 00:13:11 +09:00
Genadi Samokovarov
252660b886 Fix a faulty form_for test
Stumbled upon this one while trying to deprecate the String/Symbol
passing to `form_for`.

This test passed on an accident, because the signature of `form_for`
currently accepts 2 positional arguments and a block. Calling it with
the wrong number of arguments caused:

```ruby
(byebug) form_for(:post, @post, html: { id: 'create-post' })
*** ArgumentError Exception: wrong number of arguments (3 for 1..2)
```

This made the test pass, because it was still an `ArgumentError`. :-)
2015-10-29 16:38:25 +02:00
Yves Senn
59ec8a592d tests, no every adapter supports "connection.version"
This solves the following issue:

```
$ bin/test
Using sqlite3
/Users/senny/Projects/rails/activerecord/test/cases/adapters/mysql2/sp_test.rb:16:in `<class:Mysql2StoredProcedureTest>': undefined method `version' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007f8bab4b5b70> (NoMethodError)
	from /Users/senny/Projects/rails/activerecord/test/cases/adapters/mysql2/sp_test.rb:5:in `<top (required)>'
	from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `require'
	from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `block in require'
	from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:268:in `load_dependency'
	from /Users/senny/Projects/rails/activesupport/lib/active_support/dependencies.rb:302:in `require'
	from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:11:in `block in require_files'
	from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:10:in `each'
	from /Users/senny/Projects/rails/railties/lib/rails/test_unit/test_requirer.rb:10:in `require_files'
	from /Users/senny/Projects/rails/railties/lib/rails/test_unit/minitest_plugin.rb:69:in `plugin_rails_init'
	from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:73:in `block in init_plugins'
	from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:71:in `each'
	from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:71:in `init_plugins'
	from /Users/senny/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/minitest-5.3.3/lib/minitest.rb:122:in `run'
	from bin/test:19:in `<main>'
```
2015-10-29 14:06:22 +01:00
Zachary Scott
8732b8b301 Merge pull request #22114 from oesgalha/docs_use_distinct
Use #distinct instead of #uniq in the guides
2015-10-29 21:47:24 +09:00
oesgalha
e1ca69713c Use #distinct instead of #uniq in the guides [ci skip]
* #uniq is an alias of #distinct
* #uniq will be deprecated, see: rails/rails@adfab2dcf4
2015-10-29 10:22:42 -02:00
Kasper Timm Hansen
0fb2d1a0ba Ignore scope in missing translation input.
It's already represented in the key name. Demonstrate with a test.

Also test that the default isn't output.
2015-10-28 21:52:33 +01:00
Arthur Nogueira Neves
367e483229 Merge pull request #21998 from kddeisz/rake_task_statistics
Allow rake:stats to account for rake tasks
2015-10-28 16:43:10 -04:00
Sean Griffin
f7d0a3ba7e Merge pull request #18548 from sebjacobs/support-bidirectional-destroy-dependencies
Add support for bidirectional destroy dependencies
2015-10-28 12:24:07 -06:00
Arthur Nogueira Neves
d74c89ac16 Merge pull request #22073 from arunagw/remove-require-sdoc-rakefile
Remove required `sdoc` from Rakefile
2015-10-28 13:21:26 -04:00
Arthur Nogueira Neves
015e8b21bb Merge pull request #22099 from yui-knk/doc_as_instrumentation
[ci skip] Add `:binds` to a list of paramaters of `sql.active_record`
2015-10-28 12:02:19 -04:00
yui-knk
57fc23548f [ci skip] Add :binds to a list of paramaters of sql.active_record 2015-10-28 23:45:28 +09:00
Richard Schneeman
8b7128a142 Merge pull request #22096 from Gaurav2728/change_deprecated_msg
specify deprecated waring, follow the standard conventions
2015-10-28 07:39:53 -07:00
Gaurav Sharma
4ff9a824bf specify deprecated waring, follow the standard conventions
`skip_filter`, `skip_action_callback` may both are deprecated in Rails 5.1 so waring msg should be specific.
2015-10-28 13:09:18 +05:30
Rafael Mendonça França
a05f410029 Write the cookie jar it was not committed in TestCase
For ActionController::Base we write the cookies in a middleware if it
was not yet committed no matter if the response was committed or not. [1]

For ActionController::Live we write the cookies before the response is
committed. [2]

We already mimic ActionController::Live in
ActionController::TestCase but we don't mimic the ActionController::Base
behavior because we were checking if the response was committed before
writing the cookies.

Now we are matching the behavior of the middleware and writing the
cookies if it was not written before.

[1]: 80c6b901d4/actionpack/lib/action_dispatch/middleware/cookies.rb (L599-L604)
[2]: 80c6b901d4/actionpack/lib/action_controller/metal/live.rb (L218-L223)
2015-10-28 02:45:29 -02:00
Rafael Mendonça França
80c6b901d4 Remove dead code
This is leftover from when `render nothing: true` rendered blank string.
2015-10-28 01:39:23 -02:00
Rafael França
a887676004 Merge pull request #22095 from ajmyers01/fix_typo_in_eager_load_polymorphic_error
Fix Typo in EagerLoadPolymorphicError [ci skip]
2015-10-27 23:15:42 -02:00
Alex Myers
26f2447252 Fix Typo in EagerLoadPolymorphicError [ci skip] 2015-10-27 21:05:22 -04:00
Rafael Mendonça França
0ef2256c4a Merge pull request #18383 from scambra/habtm-with-where-includes-16032-for-master
Includes HABTM returns correct size now
2015-10-27 22:07:41 -02:00
Rafael França
c19d664380 Merge pull request #22093 from y-yagi/fix_typo_in_db_purge
fix typo in `db:purge` description [ci skip]
2015-10-27 21:43:14 -02:00
yuuji.yaginuma
17541c701e fix typo in db:purge description [ci skip] 2015-10-28 08:32:09 +09:00
Kasper Timm Hansen
0174837bfa Merge pull request #22087 from yui-knk/fix_ar_changelog
[ci skip] Aline code examples in AR changelog
2015-10-27 16:14:51 +01:00
Santiago Pastorino
7a9ce69ce0 Merge pull request #22078 from arunagw/secret-key-as-an-integer
raise `ArgumentError` when `SECRET_KEY_BASE` is an integer
2015-10-27 11:32:41 -02:00
yui-knk
64d4571f6c [ci skip] Aline code examples in AR changelog 2015-10-27 20:12:31 +09:00
Arun Agrawal
4810f401c4 raise ArgumentError when SECRET_KEY_BASE is an integer
If `SECRET_KEY_BASE` or other `secret` gets passed as other then string
we need to raise `ArgumentError` to know that it's a wrong argument.

Closes #22072
2015-10-27 10:18:05 +01:00
Guo Xiang Tan
190c69ece3 Remove skipped JRuby tests that are passing on 9.0.3.0. 2015-10-27 01:13:28 -02:00
Rafael Mendonça França
8e57ed1a39 Revert "Merge pull request #21994 from mtodd/inherit-scopes"
This reverts commit 60c9701269f5b412849f1a507df61ba4735914d7, reversing
changes made to 6a25202d9ea3b4a7c9f2d6154b97cf8ba58403db.

Reason: Broken build
2015-10-27 01:12:03 -02:00
Arthur Neves
60c9701269 Merge pull request #21994 from mtodd/inherit-scopes
Fix InheritanceTest#test_scope_inherited_properly implementation bugs
2015-10-26 22:04:02 -04:00
Matt Todd
3c4aa73ce8 Make inherited scope test fail
This triggers the JoinDependency work to reflect on the associations
and trigger an error as follows:

  ActiveRecord::ConfigurationError: Association named 'account' was
  not found on Company; perhaps you misspelled it?

Fix Company.of_first_firm joins association name

Should be `Company.joins(:accounts)` not `Company.joins(:account)`.

Do the same for Client.of_first_firm
2015-10-26 21:36:43 -04:00
schneems
6a25202d9e [ci skip] Add doc for preloader_for 2015-10-26 18:07:34 -05:00
schneems
d81fbe22ed [ci skip] Clarify doc for preloaders_for_one 2015-10-26 18:07:34 -05:00
schneems
3a6872c49a [ci skip] Add doc to preloaders_on 2015-10-26 18:07:34 -05:00
Sean Griffin
118232aef4 Merge pull request #19686 from tsun1215/index_errors
Errors can be indexed with nested attributes

Close #8638
2015-10-26 16:05:16 -06:00
Rafael França
2794de05d6 Merge pull request #22080 from AnnaErshova/edits-config-code-text
Edits default `config/boot.rb` to match what's generated by Rails 4.2.
2015-10-26 17:41:53 -02:00
AnnaErshova
6eada87b61 Edits default config/boot.rb to match what's generated by Rails 4.2. 2015-10-26 15:22:30 -04:00
Sean Griffin
04bc52f7dc Merge pull request #19924 from iamvery/db-tasks-exit-status
Explicitly exit with status "1" for create and drop failures
2015-10-26 12:27:58 -06:00
schneems
67b8f92743 [ci skip] Fix method documentation location 2015-10-26 11:36:12 -05:00
Sean Griffin
6616cb866e Merge pull request #22071 from yui-knk/redefine_method_keep_visibility
Make `Module#redefine_method` to keep method visibility
2015-10-26 06:48:04 -06:00
Arun Agrawal
f65c891f38 Remove required sdoc from Rakefile
This is required inside `api/task`
2015-10-26 11:51:05 +01:00
yui-knk
7189e5554e Make Module#redefine_method to keep method visibility
Before this commit `Module#redefine_method` always changes
visibility of redefined method to `public`.
This commit changes behavior of Module#redefine_method` to
keep method visibility.
2015-10-26 19:40:46 +09:00
Sean Griffin
0946318386 Merge pull request #22064 from kamipo/do_not_omit_parentheses
Do not omit parentheses [ci skip]
2015-10-25 11:54:28 -05:00
Claudio B
504e5e102b Merge pull request #22060 from sebmck/tweak-wording
Tweaked wording used in some tests.
2015-10-25 08:04:40 -07:00
Yves Senn
5746638e55 Merge pull request #22062 from y-yagi/fix_rdoc_markup
fix rdoc markup [ci skip]
2015-10-25 13:51:18 +01:00