Commit Graph

58943 Commits

Author SHA1 Message Date
Rafael Mendonça França
ab503f72c5
Do not require rb-inotify 2016-07-27 23:47:26 -03:00
Rafael Mendonça França
5859cbddc3
Use a form of rb-inotify to fix broken tests with Ruby 2.2.5
See https://github.com/nex3/rb-inotify/pull/49
2016-07-27 23:39:10 -03:00
Rafael França
70ec7feaec Merge pull request #25767 from kamipo/association_name_is_the_same_as_join_table_name
Correctly return `associated_table` when `associated_with?` is true
2016-07-27 23:23:05 -03:00
Takeshi AKIMA
ea1dcbbc99 Add the TABLE_SCHEMA condition to the SELECT statement in table_comment (#25945)
[Rafael Mendonça França + Takeshi AKIMA]
2016-07-27 23:19:08 -03:00
Sean Griffin
a64d9835f1 Merge pull request #25702 from k0kubun/joins-circular-reference
Remove circular join references in join_dependency
2016-07-27 20:31:38 -04:00
Rafael França
2a095142fb Merge pull request #25963 from bdewater/auth_tag_doc
Add rationale for checking auth_tag length for AEAD ciphers
2016-07-27 21:29:41 -03:00
Rafael Mendonça França
c1dc565f1e
Merge pull request #25913 from chrisarcand/fix-keyed-defaults-with-root
Fix keyed defaults with root
2016-07-27 20:28:54 -03:00
Rafael Mendonça França
4f8a594f18
Generators and tests are under the same style rules 2016-07-27 20:26:39 -03:00
Rafael Mendonça França
3778350fed
Bump arel 2016-07-27 20:23:31 -03:00
Rafael França
c191778308 Merge pull request #25938 from kamipo/decouple_statement_cache_from_connection_adapter
Decouple statement cache from connection adapter
2016-07-27 20:10:31 -03:00
Takashi Kokubun
28c29973aa Remove circular join references in join_dependency
Fixes #25653.
2016-07-28 03:25:20 +09:00
Bart de Water
73209aa7a3 Add rationale for manually checking auth_tag length, which got lost when #25874 was squashed before merging [skip ci] 2016-07-27 13:41:40 +02:00
Yves Senn
7e6996a1b3 Merge pull request #25958 from kamipo/should_be_target_loaded
Add an assertion to the tests that should be loaded the target.
2016-07-27 09:55:43 +02:00
Yves Senn
d0f8061cae Merge pull request #25408 from kamipo/should_not_reuse_quoted_true
Quoting booleans should return a frozen string
2016-07-27 08:20:22 +02:00
Santiago Pastorino
1a2f1c48bd There are some cases where @@app is not defined 2016-07-26 22:04:56 -03:00
Sean Griffin
d980abdb23 Merge pull request #25523 from kamipo/extract_quoted_binds_type_casted_binds
Extract `type_casted_binds` method
2016-07-26 17:38:17 -04:00
Santiago Pastorino
6594226c9c Be more explicit with the expected result 2016-07-26 15:54:01 -03:00
Santiago Pastorino
f2978409e9 Return ActionDispatch.test_app when no app is set on IntegrationTest.app method
Fixes #25926
2016-07-26 15:47:44 -03:00
Guillermo Iguaran
cbc61f5136 Merge pull request #25919 from benpickles/skip-javascript-also-skips-uglifier
Uglifier should not be included when generating a new app with `--skip-javascript`
2016-07-26 13:25:30 -05:00
Ben Pickles
09ed4e95ac A generated app should not include Uglifier with --skip-javascript option. 2016-07-26 19:18:30 +01:00
Santiago Pastorino
49315e2789 Merge pull request #25912 from stevenharman/fix_render_partial_collection_to_allow_custom_collection
Changed partial rendering to allow collections which don't implement `#to_ary`.
2016-07-26 14:14:41 -03:00
Chris Arcand
2a946da9bb
Update changelog 2016-07-26 11:05:32 -05:00
Ryuta Kamizono
a3a6d74c77 Quoting booleans should return a frozen string
If reuse `QUOTED_TRUE` and `QUOTED_FALSE` without frozen, causing the
following issue.

```
Loading development environment (Rails 5.1.0.alpha)
irb(main):001:0> ActiveRecord::Base.connection.quote(true) << ' foo'
=> "1 foo"
irb(main):002:0> ActiveRecord::Base.connection.quote(true) << ' foo'
=> "1 foo foo"
irb(main):003:0> type = ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString.new
=> #<ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString:0x007fd40c15e018 @precision=nil, @scale=nil, @limit=nil>
irb(main):004:0> type.serialize(true) << ' bar'
=> "1 foo foo bar"
irb(main):005:0> type.cast(true) << ' bar'
=> "1 foo foo bar bar"
```
2016-07-27 00:44:16 +09:00
Steven Harman
87899cfcf0 Use to_a to pre-buffer the collection
We can safely assume we're not dealing with an infinite collection as
we're about to call `each` on it and collect the results until it
terminates on its own. Given that, `to_a` is implemented by the normal
Array-like objects, and less Array-like objects like `Enumerator` and
`Enumerator::Lazy`.
2016-07-26 11:33:34 -04:00
Ryuta Kamizono
92c8f01580 Add an assertion to the tests that should be loaded the target.
These test cases tests exactly mutating loaded target.
2016-07-27 00:32:50 +09:00
Santiago Pastorino
c4b33a7796 Merge pull request #25929 from kamipo/load_target_is_public_method
`load_target` is a public method
2016-07-26 11:43:47 -03:00
Steven Harman
e4a4936244 Default to an empty collection if falsey given
This will ensure we attempt to render an empty collection, meaning we
don't actually render anything at all. Allowing `nil` or a falsey value
through results in calling `render_partial` rather than
`render_collection`, which isn't what we want.
2016-07-26 10:38:58 -04:00
Steven Harman
578096b971 Use Ruby >= 1.9 hash syntax as is the preference 2016-07-26 10:38:58 -04:00
Steven Harman
ae75930b59 Fix collection_from_options to allow Enumerators
An optimization was introduced in
27f4ffd11a
which tried to `#to_ary` the collection to prevent unnecessary queries
for ActiveRecord scopes/relations. If the given collection did not
respond to `#to_ary`, and empty collection was returned. That meant you
couldn't use collections built from `Enumerator` nor `Enumerable`.

With this change, `#collection_from_options` will attempt the
optimization, but fall back to passing along the given collection,
as-is.
2016-07-26 10:38:58 -04:00
Santiago Pastorino
c59715fa25 Merge pull request #25953 from kamipo/make_force_signal37_to_load_all_clients_of_firm_to_private
Make `force_signal37_to_load_all_clients_of_firm` to private
2016-07-26 11:30:43 -03:00
Santiago Pastorino
d6dfbe8396 Merge pull request #25936 from prathamesh-sonpatki/bump-arel
Bump Arel to fix few failing tests on Ruby 2.4 related to the Integer unification
2016-07-26 11:29:42 -03:00
Ryuta Kamizono
944c7b9818 Make force_signal37_to_load_all_clients_of_firm to private
This is not a test case.
2016-07-26 13:14:59 +09:00
Ryuta Kamizono
d31c2e2cf8 Extract type_casted_binds method
Because `type_cast` against `binds` always requires
`attr.value_for_database` and this pattern appears frequently.
2016-07-26 09:49:53 +09:00
Rafael França
245c64d428 Merge pull request #25950 from jules2689/master
Fix an exception where content-type is nil
2016-07-25 16:41:33 -03:00
Julian Nadeau
814ebb996d
Also yield in parameters for a nil content_mime_type 2016-07-25 11:32:49 -04:00
Sean Griffin
aa7a6047c2 Whoops, forgot the changelog entry for the previous commit 2016-07-25 11:13:01 -04:00
Sean Griffin
f0ddf87e4b Correct the behavior of virtual attributes on models loaded from the db
Previously we had primarily tested the behavior of these attributes by
calling `.new`, allowing this to slip through the cracks. There were a
few ways in which they were behaving incorrectly.

The biggest issue was that attempting to read the attribute would
through a `MissingAttribute` error. We've corrected this by returning
the default value when the attribute isn't backed by a database column.
This is super special cased, but I don't see a way to avoid this
conditional. I had considered handling this higher up in
`define_default_attribute`, but we don't have the relevant information
there as users can provide new defaults for database columns as well.

Once I corrected this, I had noticed that the attributes were always
being marked as changed. This is because the behavior of
`define_default_attribute` was treating them as assigned from
`Attribute::Null`.

Finally, with our new implementation, `LazyAttributeHash` could no
longer be marshalled, as it holds onto a proc. This has been corrected
as well. I've not handled YAML in that class, as we do additional work
higher up to avoid YAML dumping it at all.

Fixes #25787
Close #25841
2016-07-25 11:12:06 -04:00
Xavier Noria
7ebef567ce systematic revision of =~ usage in AV
Where appropriate, prefer the more concise Regexp#match?,
String#include?, String#start_with?, or String#end_with?
2016-07-25 00:31:35 +02:00
Xavier Noria
11b463d8cb use \A and \z when you mean \A and \z
In Ruby ^ and $ mean start and end of *line*.

A regexp that validates an email should not check if
some line of the string looks like an email, and maybe
be surrounded by the entire Joyce's Ulysses. What the
regexp has to check is if the string itself looks like
an email.

This validator is used only in tests, the ^/$ anchors
implied no risk.
2016-07-24 21:42:19 +02:00
Xavier Noria
95b2a6abc7 adds missing requires 2016-07-24 21:29:29 +02:00
Xavier Noria
5a83f05424 systematic revision of =~ usage in AMo 2016-07-24 21:23:23 +02:00
Ryuta Kamizono
e703de17d8 Decouple statement cache from connection adapter
`StatementCache` is hard-coded in `cacheable_query` and be passed
`visitor` and `collector` from connection adapter. Simply it is
enough to pass a collected value.
2016-07-24 22:18:07 +09:00
प्रथमेश Sonpatki
56527bb737 Merge pull request #25928 from mechanicles/info-for-cache-fetch-block
Add proper description for `Rails.cache.fetch` [ci skip]
2016-07-24 10:13:41 +05:30
Santosh Wadghule
d4f1b8090a Proper description for Rails.cache.fetch [ci skip] 2016-07-24 09:37:44 +05:30
Prathamesh Sonpatki
1a50262b5b
Bump Arel to fix few failing tests on Ruby 2.4 related to the Integer unification
* Following tests were failing on Ruby edge 2.4 version -

- RelationTest#test_update_all_with_joins_and_offset_and_order:
- RelationTest#test_update_all_with_joins_and_offset:
- BasicsTest#test_no_limit_offset:
- CalculationsTest#test_offset_is_kept:
- ActiveRecord::CollectionCacheKeyTest#test_cache_key_for_queries_with_offset_which_return_0_rows:
- FinderTest#test_third_to_last:

* As Arel 7.1 supports Integer unification after https://github.com/rails/arel/pull/437 we can use it.
2016-07-24 09:17:45 +05:30
Xavier Noria
7714e83da0 removes spurious line 2016-07-24 00:50:24 +02:00
Xavier Noria
f9f39d5c42 give some love to this test file
It all started noticing some foo.method({ ... }) method calls
in passing. This is a whole pass modernizing this file.

While some string literals are edited where I touched code,
this pass does not uniformizes quotes. A ton are left untouched
on purposes. We have no defined style.
2016-07-23 23:15:26 +02:00
Xavier Noria
99cf755800 systematic revision of =~ usage in AR
Where appropriatei, prefer the more concise Regexp#match?,
String#include?, String#start_with?, or String#end_with?
2016-07-23 20:22:20 +02:00
Ryuta Kamizono
beb6b7add7 load_target is a public method
`send` is unnecessary.
2016-07-23 17:14:41 +09:00
Kasper Timm Hansen
1ca571cc47 Merge pull request #25908 from mechanicles/derives-from
Explain meaning of the code very well and Remove confusion. [ci skip]
2016-07-23 07:48:17 +02:00