Commit Graph

4326 Commits

Author SHA1 Message Date
Aaron Patterson
170fb5c80c reduce the number of queries on IN clauses, fix relation queries in where 2013-01-24 14:29:03 -08:00
Akira Matsuda
8dc7ef9728 Describing the reason for defining BlankTopic#blank? which will never be called 2013-01-24 22:07:43 +09:00
Akira Matsuda
0400139038 Revert "Unused methods, module, etc."
This reverts commit 4e05bfb8e254c3360a3ca4a6cb332995314338fe.

Reason: BlankTopic#blank? should not be removed to check that dynamic finder with a bang can find a model that responds to `blank?`
2013-01-24 21:44:02 +09:00
Akira Matsuda
4e05bfb8e2 Unused methods, module, etc. 2013-01-24 21:23:49 +09:00
Akira Matsuda + Koichi Sasada
b7b27fc2a3 Set Thread.abort_on_exception for the whole AS, AP, and AR tests
this would give us some more clues in case a test silently dies inside Thread
2013-01-24 20:00:45 +09:00
Akira Matsuda
07c7cb4cc5 Unused test model 2013-01-24 18:41:37 +09:00
Akira Matsuda
f228ab5574 Goodbye there, very special rubbish! 2013-01-24 18:40:59 +09:00
Akira Matsuda
4bdcd7a654 proxy_{owner,reflection,target} are no more available 2013-01-24 17:10:54 +09:00
Akira Matsuda
68418fbe9b Unused model DeprecatedPostWithComment 2013-01-24 17:10:53 +09:00
Andrew White
c5989cc483 Fix PostgreSQL tests on Travis
Travis only has PostgreSQL 9.1.x but 9.2 is required for range datatypes.
2013-01-24 00:16:01 +00:00
Rafael Mendonça França
3af85ed311 Merge pull request #7345 from slbug/master
Postgresql range support
2013-01-23 12:14:56 -08:00
Andrew White
1b75b94de6 Remove warning by using a custom coder
The native JSON library bypasses the `to_json` overrides in
active_support/core_ext/object/to_json.rb by calling its native
implementation directly. However `ActiveRecord::Store` uses a
HWIA so `JSON.dump` will call our `to_json` instead with a
`State` object for options rather than a `Hash`. This generates
a warning when the `:encoding`, `:only` & `:except` keys are
accessed in `Hash#as_json` because the `State` object delegates
unknown keys to `instance_variable_get` in its `:[]` method.

Workaround this warning in the test by using a custom coder that
calls `ActiveSupport::JSON.encode` directly.
2013-01-23 14:54:56 +00:00
bUg
af1ef85ad2 Add postgresql range types support 2013-01-23 13:37:14 +01:00
Akira Matsuda
4beb4decec A test case name needs to start with "test_" 2013-01-23 15:22:13 +09:00
Andrew White
5c4a186dd5 Revert "Round usec when writing timestamp attribute."
This reverts commit e9d2ad395ec2ef929d74752f3d71c80674044fbe.

Closes #8460

Conflicts:
	activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
	activerecord/test/cases/dirty_test.rb
2013-01-22 14:16:59 +00:00
Andrew White
1cf73a6fed Add failing test case for #8460
Add a test case to ensure that fractional second updates are detected.
2013-01-22 14:16:59 +00:00
Rafael Mendonça França
4de3b3dac5 Whitespaces ✂️
[ci skip]
2013-01-22 00:30:45 -02:00
Akira Matsuda
e56c80a172 Reset SchemaMigration after updating 2013-01-22 10:26:51 +09:00
Akira Matsuda
1d7221c508 Preload some join table schemas 2013-01-22 05:24:23 +09:00
Akira Matsuda
5538a02077 Be sure to clear schema cache 2013-01-22 05:24:23 +09:00
Akira Matsuda
2c613f9d37 Reset table_name_{prefix,suffix}, and table_name after each test
because some tests were not resetting them, and thus the tests were order dependent
2013-01-22 05:24:23 +09:00
Akira Matsuda
59e2630ca7 Missing repair_validations 2013-01-22 05:24:23 +09:00
wangjohn
26853e8948 Refactored transaction state into its own object. Each transaction creates a new transaction state object upon initialization. 2013-01-21 12:16:55 -05:00
Vipul A M
7f5dd5b629 Remove extra sort from test
Cleanup change_schema tests to remove extra sorts on columns.
2013-01-21 14:04:55 +05:30
Carlos Antonio da Silva
2e8b3d5c9a Merge pull request #8913 from seejee/regression_test_for_chained_preloaded_scopes
Added test case to prevent regression of chained, preloaded scopes.
2013-01-20 16:58:41 -08:00
Aaron Patterson
a1c0e51a2c Merge pull request #9006 from wangjohn/activerecord_transaction_state
Created state for a transaction and added tests.
2013-01-20 11:04:22 -08:00
wangjohn
0355962c27 Created state for a transaction and added tests. 2013-01-20 12:40:36 -05:00
Guillermo Iguaran
996aba341a Don't use anonymous classes in connection tests 2013-01-19 22:13:05 -05:00
Guillermo Iguaran
f48a16bdb2 Anonymous class is not allowed. For reference see #8934 and bc43763247e25 2013-01-19 20:33:14 -05:00
David
bc43763247 fix anonymous class issue 2013-01-20 07:56:43 +08:00
Chris Geihsler
7f6872e85b Added test case to prevent regression of chained, preloaded scopes. (#7490) 2013-01-19 18:53:25 -05:00
Jon Leighton
40e7978279 Merge pull request #8994 from Springest/fix_default_scope_update_all_delete_all
Fix .update_all and .delete_all when using a condition on a joined table in a default_scope
2013-01-18 08:51:55 -08:00
Guillermo Iguaran
8aebe30ef4 Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"
This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing
changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
2013-01-18 09:15:19 -05:00
Guillermo Iguaran
637a7d9d35 Merge pull request #8989 from robertomiranda/use-rails-4-find-by
Replace deprecated find_by_* with find_by
2013-01-18 05:06:42 -08:00
robertomiranda
7baecc4802 User Rails 4 find_by 2013-01-18 07:56:05 -05:00
Jon Leighton
5937bd02de Undeprecate the :extend option
Suggested by @dhh.

It doesn't affect the generated SQL, so seems reasonable to continue to
allow it as an association option.
2013-01-18 12:30:47 +00:00
Jon Leighton
5f759ff063 CollectionProxy should be default scoped
Fixes #8795
2013-01-18 11:25:00 +00:00
Jon Leighton
e8d80f7399 Merge pull request #8912 from senny/8879_association_empty_method
`CollectionAssociation#empty?` respects newly builded records
2013-01-18 02:08:13 -08:00
Vitor Baptista
e1e5f30057 Don't rely on Hash key's ordering
If we set encoding latin1 for a PostgreSQL database, it calls
PostgreSQLAdapter::create_database with options that have,
among other things:

  { 'encoding' => 'latin1' }

Then, we use reverse_merge(:encoding => "utf8") to setup the default
encoding. In the end, the hash looks like:

  { :encoding => 'utf8', 'encoding' => 'latin1' }

The call to options.symbolize_keys calls to_sym on each_key of this
Hash. It usually means that the encoding passed overwrites the default
utf8, but it's not guaranteed. So, we shouldn't rely on it.

The same was happening in ActiveRecord::ConnectionHandling.
2013-01-16 10:43:30 -03:00
Carlos Antonio da Silva
5d06f8a0a5 Revert "Merge pull request #8942 from yahonda/tested_only_with_mysql"
This reverts commit 1fc294f988e93ac59057a16b0e44b9cf93af9720, reversing
changes made to fb9ac47c286fbdfe05263d4d0346e50892090603.

Reason: these tests should run fine independent of database, since they
should only take into account the configuration options. The problem was
related to a change in the way "nil" is handled by the rescue clause, in
Ruby 2.0 it raises an exception asking for class or module, in 1.9 it
passes.
2013-01-15 09:18:55 -02:00
Yasuo Honda
28ac50b7b3 Address test_create_when_database_exists_outputs_info_to_stderr failures
When tested with ruby-2.0.0-rc1 `rake test` executes this test
even if the target adapter is not mysql nor mysql2.
2013-01-15 04:56:37 +09:00
Yves Senn
ec07735641 CollectionAssociation#empty? respects newly builded records 2013-01-13 00:20:38 +01:00
Carlos Antonio da Silva
9b636dcf53 Bring back "database already exists" messages when running rake tasks
When running tasks such "rake db:setup", instead of showing messages
like "db_development already exists", it was showing a big stack trace
and a message "Couldn't create database for ..." with the configuration
options, a very confusing message with a big trace.

This brings back the functionality present in 3-2, showing the same
message.
2013-01-12 09:28:13 -02:00
Derek Kraan
bc4edca7b1 Fix .update_all and .delete_all when using a condition on a joined table
in a default_scope.

`Model.joins(...).where(condition_on_joined_table).update_all` /
`delete_all` worked, but the same operation implemented with a
default_scope generated a SQL error because ActiveRecord ignored the
join but implemented the where condition anyways.
2013-01-11 12:31:09 -05:00
Jon Leighton
15b7482dfc Merge pull request #8568 from inossidabile/fix-in_clause_length
Correct source for in_clause_length for eager loading (Fix for #8474)
2013-01-11 01:34:43 -08:00
Carlos Antonio da Silva
507d23c421 Fix syntax error and remove duplicated test 2013-01-08 20:00:51 -02:00
Aaron Patterson
8e577fe560 * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu
Conflicts:
	actionpack/CHANGELOG.md
	actionpack/lib/action_dispatch/http/request.rb
	actionpack/lib/action_dispatch/middleware/params_parser.rb
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/predicate_builder.rb
	activerecord/test/cases/relation/where_test.rb
2013-01-08 12:41:24 -08:00
Jeremy Kemper
c31cc963da Revert "Merge branch 'master-sec'"
This reverts commit 88cc1688d0cb828c17706b41a8bd27870f2a2beb, reversing
changes made to f049016cd348627bf8db0d72382d7580bf802a79.
2013-01-08 12:41:04 -08:00
Aaron Patterson
88cc1688d0 Merge branch 'master-sec'
* master-sec:
  CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml.
  * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu
2013-01-08 12:11:18 -08:00
Vijay Dev
f049016cd3 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/getting_started.md
2013-01-09 01:04:15 +05:30