Commit Graph

8946 Commits

Author SHA1 Message Date
Aaron Patterson
439ac72013 add API to pg for enabling / disabling hstore 2013-01-28 16:47:40 -08:00
Xavier Noria
8fff05ad32 updates a dynamic method heredoc doc 2013-01-28 18:39:44 +01:00
Xavier Noria
249f58b7ec explains why the query cache checks arel.locked 2013-01-28 18:14:33 +01:00
Akira Matsuda
5f30b547c8 Use Encoding::UTF_8 constant 🚯 2013-01-28 17:06:02 +09:00
Jon Leighton
c8d889905d Prevent Relation#merge from collapsing wheres on the RHS
This caused a bug with the new associations implementation, because now
association conditions are represented as Arel nodes internally right up
to when the whole thing gets turned to SQL.

In Rails 3.2, association conditions get turned to raw SQL early on,
which prevents Relation#merge from interfering.

The current implementation was buggy when a default_scope existed on the
target model, since we would basically end up doing:

  default_scope.merge(association_scope)

If default_scope contained a where(foo: 'a') and association_scope
contained a where(foo: 'b').where(foo: 'c') then the merger would see
that the same column is representated on both sides of the merge and
collapse the wheres to all but the last: where(foo: 'c')

Now, the RHS of the merge is left alone.

Fixes #8990
2013-01-27 20:34:52 +00:00
Carlos Antonio da Silva
78562309fc Fix typo: adaptors => adapters [ci skip] 2013-01-27 16:54:07 -02:00
Derek Kraan
0a71c7b864 Fix cases where delete_records on a has_many association caused errors
because of an ambiguous column name. This happened if the association
model had a default scope that referenced a third table, and the third
table also referenced the original table (with an identical
foreign_key).

Mysql requires that ambiguous columns are deambiguated by using the full
table.column syntax. Postgresql and Sqlite use a different syntax for
updates altogether (and don't tolerate table.name syntax), so the fix
requires always including the full table.column and discarding it later
for Sqlite and Postgresql.
2013-01-27 15:36:29 +00:00
Lucas Mazza
70af2bde29 Use silence instead of quietly to silence the CheckPending middleware.
`Kernel.quietly` silences `STDOUT` and `STDERR`, which is useless if
the logger is writing to a file, while `AS::Logger#silence` swaps the
logger level to `ERROR`.

Related to #8820 and #8052.
2013-01-26 18:11:04 -02:00
Andrew White
41ff6a1021 Simplify type casting code for timezone aware attributes
With the addition of String#in_time_zone and Date#in_time_zone
we can simplify the type casting code by checking if the value
has an `in_time_zone` method.
2013-01-26 16:57:34 +00:00
Lilibeth De La Cruz
bc982cbcb3 Fix handling of dirty time zone aware attributes
Previously, when `time_zone_aware_attributes` were enabled, after
changing a datetime or timestamp attribute and then changing it back
to the original value, `changed_attributes` still tracked the
attribute as changed. This caused `[attribute]_changed?` and
`changed?` methods to return true incorrectly.

Example:

    in_time_zone 'Paris' do
      order = Order.new
      original_time = Time.local(2012, 10, 10)
      order.shipped_at = original_time
      order.save
      order.changed? # => false

      # changing value
      order.shipped_at = Time.local(2013, 1, 1)
      order.changed? # => true

      # reverting to original value
      order.shipped_at = original_time
      order.changed? # => false, used to return true
    end
2013-01-26 16:57:33 +00:00
Xavier Noria
0b5d3f3273 Merge remote-tracking branch 'docrails/master'
Conflicts:
	actionpack/lib/action_view/helpers/form_options_helper.rb
	guides/code/getting_started/app/controllers/comments_controller.rb
2013-01-26 17:41:56 +01:00
Yves Senn
648def4060 #count in conjunction with #uniq performs distinct count.
closes #6865
2013-01-26 12:16:28 +01:00
Jon Leighton
48d05bdd97 Remove obsolete test file
4beb4decec (commitcomment-2482869)
2013-01-25 09:52:53 +00:00
Aaron Patterson
170fb5c80c reduce the number of queries on IN clauses, fix relation queries in where 2013-01-24 14:29:03 -08:00
Aaron Patterson
de6a35b38a stop converting strings to symbols 2013-01-24 13:47:46 -08:00
Akira Matsuda
a8eb13a87f Default dead_connection_timeout to 5
or the ConnectionPool silently fails to close connections inside the Thread
2013-01-24 22:53:40 +09: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
Rafael Mendonça França
5f412956cf Less strict activerecord-deprecated_finders version 2013-01-22 14:06:42 -02: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
484a0fd7fc Just ignore all PRAGMA queries 2013-01-22 10:26:51 +09:00
Akira Matsuda
e56c80a172 Reset SchemaMigration after updating 2013-01-22 10:26:51 +09:00
Tatsuro Baba
cb413c77cd Fix typo 2013-01-22 09:48:38 +09:00
Akira Matsuda
1d7221c508 Preload some join table schemas 2013-01-22 05:24:23 +09:00
Akira Matsuda
31ccedd440 Ignore schema queries on SQLite 3 as well 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
5a350cdb9c Ignore "SHOW search_path" when counting PostgreSQL queries 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
Guillermo Iguaran
d4261d8562 Merge pull request #9008 from ranjaykrishna/dbcreate
Added a new rake task in activerecord
2013-01-20 11:11:21 -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
bbcebb6ab2 Added a changelog entry. 2013-01-20 14:02:12 -05:00
Ranjay Krishna
3e74012d66 added db:drop task that executes mysql:drop_databses and postgresql:drop_databases 2013-01-20 11:00:26 -08:00
wangjohn
6ca34289d9 Removed reflects_transaction_state. 2013-01-20 13:19:05 -05:00