Commit Graph

33815 Commits

Author SHA1 Message Date
Trevor Turk
06faa6da80 Use BCrypt's MIN_COST in the test environment for speedier tests 2012-11-14 09:42:54 -06:00
Carlos Antonio da Silva
087150d9b7 Merge pull request #8202 from nikitug/regression_test_on_dynamic_finder_result
Regression test for #7238
2012-11-13 06:59:17 -08:00
Nikita Afanasenko
8424d0dda3 Regression test for #7238 2012-11-13 18:39:07 +04:00
Rafael Mendonça França
3a335720db Merge pull request #8176 from senny/7551_pluck_with_select
`#pluck` can be used on a relation with `select` clause (#7551)
2012-11-13 06:27:42 -08:00
Rafael Mendonça França
12990c4e61 Merge pull request #8201 from nikitug/regression_test_on_ar_cache_key_precision
Add a regression test on #8195
2012-11-13 05:06:50 -08:00
Carlos Antonio da Silva
c940aa6ed5 Use new mocha version and add changelog entry for #8180 2012-11-13 08:57:04 -02:00
Carlos Antonio da Silva
395d6b43b8 Merge pull request #8180 from freerange/mocha-fixes-supporting-only-0.13-onwards
Simplify code by taking advantage of latest mocha (v0.13.0).
2012-11-13 02:36:17 -08:00
Nikita Afanasenko
ff2973a09a Add a regression test on #8195 2012-11-13 13:33:45 +04:00
Aaron Patterson
8f3f50a3cc Ruby 2.0.0 defaults source encoding to utf-8 so we need to specifically tag this file with us-ascii 2012-11-12 18:17:16 -08:00
Carlos Antonio da Silva
d5c4370ef5 Merge pull request #8185 from senny/8182_as_json_options_stick_around
`#as_json` isolates options when encoding a hash. Closes #8182
2012-11-12 17:53:17 -08:00
Aaron Patterson
85cc7122ba only clear caches if we are actually connected to the database 2012-11-12 17:24:10 -08:00
Xavier Noria
5287d3678d depend on voloko/sdoc again
voloko/sdoc seems to be maintained again, in particular
the issues that made us fork it are resolved.
2012-11-12 22:51:59 +01:00
Carlos Antonio da Silva
2a8b673bc4 Merge pull request #8184 from vipulnsward/add_merge_tests
Merge and add tests related to #5215
2012-11-12 08:52:31 -08:00
Yves Senn
663d9ef670 #pluck can be used on a relation with select clause.
Closes #7551
2012-11-12 16:27:44 +01:00
Santiago Pastorino
0ecd464066 Debugger gem doesn't work with patchlevel < 327 2012-11-12 13:13:27 -02:00
Yves Senn
d5ac2801d9 cleanup, removed whitespace from CHANGELOG 2012-11-12 16:06:58 +01:00
Yves Senn
78dca35103 #as_json isolates options when encoding a hash. Closes #8182
Setting options in a custom `#as_json` method had side effects.
Modifications of the `options` hash leaked outside and influenced
the conversion of other objects contained in the hash.
2012-11-12 16:06:08 +01:00
Vipul A M
5359ad9ed1 Merge and add tests related to 5215 2012-11-12 18:13:20 +05:30
James Mead
57b333e25d Simplify code by taking advantage of latest mocha (v0.13.0).
This only works with mocha v0.13.0 or later.

Note that this also fixes a few subtle bugs present in the current
implementation :-

* Mocha was raising a `MiniTest::Assertion` instead of a
  `Mocha::ExpectationError` as intended. The latter is not recognized by
  MiniTest as an assertion failure and so it is recorded as a test
  *error*, not a test *failure* as it ought to. This leads to
  potentially confusing output in the test results.

* Mocha verification should happen as part of the test. The verification
  of expectations is equivalent to a set of assertions. These assertions
  should happen as *part of* the test so that they have a chance to
  cause the test to fail, and not just as part of the teardown. Also if
  an assertion fails during the test, then there is no need to verify
  expectations, because only the first assertion failure is normally
  reported and all subsequent bets are off.

* Expectation verification should be counted as an assertion. Mocha
  cannot record each expectation verification as an assertion, because
  we weren't passing in an assertion counter to `#mocha_verify`.
2012-11-12 09:34:21 +00:00
Carlos Antonio da Silva
2f3d81c764 Remove duplicated ConnectionHandling extension in AR::Base
Thanks @toretore.
9e4c41c903 (commitcomment-2134706)
2012-11-11 17:03:56 -02:00
Carlos Antonio da Silva
f9dc91731b Merge pull request #8173 from nikitug/match_classes_without_to_s
Match classes without to_s conversions.
2012-11-11 06:07:19 -08:00
Nikita Afanasenko
d2abfcbd8c Match classes without to_s conversions.
There is no need in `value_under_case.class.to_s` conversion since case already matches classes with `Class === value_under_case`.
2012-11-11 16:53:39 +04:00
Santiago Pastorino
eda34c4a50 Merge pull request #8172 from nikitug/silent_diff_deprecation
Test Hash#diff deprecation, also prevent deprecation message in AS tests
2012-11-11 04:46:06 -08:00
Santiago Pastorino
c49fff9327 Merge pull request #8170 from arunagw/warning_removed_railties
Removing warning : ambiguous first argument
2012-11-11 04:44:39 -08:00
Nikita Afanasenko
63ee59d48a Test Hash#diff deprecation, also prevent deprecation message in AS tests 2012-11-11 16:08:39 +04:00
Arun Agrawal
5ff5cce81a Removing warning : ambiguous first argument 2012-11-11 15:16:35 +05:30
Jon Leighton
12d6d3a6f8 Make ActiveRecord::Delegation#method_missing threadsafe
Two threads may be in method_missing at the same time. If so, they might
both try to define the same delegator method.

Such a situation probably wouldn't result in a particularly spectacular
bug as one method would probably just be overridden by an identical
method, but it could cause warnings to pop up. (It could be worse if
method definition is non-atomic in a particular implementation.)

(We will also need this mutex shortly anyway, see #8127.)
2012-11-10 21:41:31 +00:00
Vijay Dev
8ec51669d4 recent railties changes added to the release notes [ci skip] 2012-11-10 22:48:01 +05:30
Vijay Dev
3a76ee47bf update turbolinks readme link [ci skip] 2012-11-10 22:48:01 +05:30
Carlos Antonio da Silva
62039ad5a1 Merge pull request #8165 from arunagw/warning_removed_unused_variables
Removing warning : assigned but unused variable
2012-11-10 07:34:53 -08:00
Carlos Antonio da Silva
e803f3a521 Merge pull request #8154 from bogdan/has_one_association_performance
Remove unwanted transaction when has one association is built
2012-11-10 05:41:58 -08:00
Bogdan Gusiev
3cb0f3feed Do not create useless database transaction when building has_one association. 2012-11-10 15:30:20 +02:00
Arun Agrawal
c33c991eab Removing warning : assigned but unused variable 2012-11-10 17:34:39 +05:30
Carlos Antonio da Silva
a002442fbc Merge pull request #8164 from nikitug/keep_serialization_in_its_module
Keep the code related to serialization in Serialization module.
2012-11-10 02:16:40 -08:00
Nikita Afanasenko
410e887a44 Keep the code related to serialization in Serialization module.
We should not need any `serialized_attributes` checks outside `ActiveRecord::AttributeMethods::Serialization` module.
2012-11-10 01:45:43 +04:00
Rafael Mendonça França
90a1721c31 Merge pull request #8162 from fimmtiu/master
Trivial documentation fix for ActiveModel::Naming comment [ci skip]
2012-11-09 11:27:25 -08:00
Dennis Taylor
ba291a67df Trivial documentation fix for ActiveModel::Naming comment. 2012-11-09 11:23:51 -08:00
Carlos Antonio da Silva
38411b89fc Use get in the redirection doc examples
get is the most common usage, and match without an explicit verb
was disallowed in 56cdc81c08b1847c5c1f699810a8c3b9ac3715a6.

[ci skip]
2012-11-09 15:43:16 -02:00
Andrew White
42cfacfe81 Gracefully handle upgrading apps with mass assigment configs
Most apps upgrading from 3.x will have options for mass assigment in
their application.rb and environments/*.rb config files. Rather than
just raising a NoMethodError when copying the config, this commit
adds a warning message until either the protected_attributes gem
is installed or the relevant config options are removed.
2012-11-09 15:31:00 +00:00
Carlos Antonio da Silva
e56b8900f9 Merge pull request #8158 from steveklabnik/deprecate_diff
Deprecate Hash#diff.
2012-11-09 07:05:41 -08:00
Steve Klabnik
88d59de12d Deprecate Hash#diff.
It's no longer used in Rails any more.

See https://github.com/rails/rails/pull/8142\#issuecomment-10227297 for more
2012-11-09 15:57:18 +01:00
Carlos Antonio da Silva
9622b3fd2c Remove not used load hooks for active_record_config
These were removed with ActiveRecord::Model in
9e4c41c903 (L15L156)
2012-11-09 12:45:50 -02:00
Jon Leighton
1489303db2 fix warnings 2012-11-09 14:40:15 +00:00
Jon Leighton
c3ca7ac09e Properly deprecate ConnectionHandler#connection_pools
Rather than just changing it and hoping for the best.

Requested by @jeremy:

ba1544d716 (commitcomment-2106059)
2012-11-09 14:40:15 +00:00
Rafael Mendonça França
52538dda13 Merge pull request #8157 from steveklabnik/remove_callback_duplication
Removing duplication in callback normalization.
2012-11-09 05:52:28 -08:00
Steve Klabnik
c4e3b0cd8b Removing duplication in callback normalization.
These two things were 100% identical.
2012-11-09 14:43:03 +01:00
Jon Leighton
dbb39e5341 Merge pull request #8116 from senny/7993_configure_counter_cache_for_has_many
:counter_cache option for  to support custom named counter caches
2012-11-09 05:42:04 -08:00
Jon Leighton
edd94cee9a Delegate all calculations to the scope.
So that the scope may be a NullRelation and return a result without
executing a query.

Fixes #7928
2012-11-09 12:09:37 +00:00
Jon Leighton
11b846eefb CollectionProxy#pluck issues no query for a new_record? owner
Fixes #8102.

I couldn't find a nicer way to deal with this than delegate the call to
 #scope, which will be a NullRelation when we want it to be.
2012-11-09 11:43:15 +00:00
Jon Leighton
aae4f357b5 Nullify the relation at a more general level.
This allows us to avoid hacks like the "return 0 if owner.new_record?"
in #count (which this commit removes).

Also, the relevant foreign key may actually be present even on a new
owner record, in which case we *don't* want a null relation. This logic
is encapsulated in the #null_scope? method.

We also need to make sure that the CollectionProxy is not 'infected'
with the NullRelation module, or else the methods from there will
override the definitions in CollectionProxy, leading to incorrect
results. Hence the nullify: false option to CollectionAssociation#scope.
(This feels a bit nasty but I can't think of a better way.)
2012-11-09 11:43:15 +00:00