Commit Graph

8961 Commits

Author SHA1 Message Date
Rafael Mendonça França
83eccde1e2 Fix typo 💣 2013-01-31 21:51:02 -02:00
Rafael Mendonça França
3bdfecea8b Fix typo 2013-01-31 19:46:26 -02:00
Rafael Mendonça França
adb8fea493 CHANGELOG review 2013-01-31 17:48:59 -02:00
Rafael Mendonça França
9442c3e883 Strict regexp 2013-01-31 17:48:49 -02:00
Rafael Mendonça França
2b60a6b664 Extract the value casting to a method 2013-01-31 17:48:37 -02:00
Aaron Stone
4b005fb371 DATABASE_URL parsing should turn numeric strings into numeric types, and
the strings true and false into boolean types, in order to match how
YAML would parse the same values from database.yml and prevent
unexpected type errors in the database adapters.
2013-01-31 09:01:20 -08:00
Carlos Antonio da Silva
18e889f91b Merge pull request #9119 from dazuma/database_tasks_for_unknown_adapter
Raise an exception with a useful message if a rake task is requested for an unknown adapter
2013-01-31 03:22:31 -08:00
Neeraj Singh
551c9232de class_eval should use __FILE__ and __LINE__ 2013-01-30 14:26:02 -05:00
Daniel Azuma
a257d4818a Raise a specific exception with a useful message if a rake task is requested for an unknown adapter 2013-01-30 10:52:47 -08:00
Daniel Azuma
a374366720 Remove pre-emptive adapter name check from databases.rake so third party adapters can register rake tasks 2013-01-29 17:46:48 -08:00
Aaron Patterson
efd2be3551 reloading type map on extension changing 2013-01-29 15:49:35 -08:00
Aaron Patterson
95e87bfaa3 fixing comment 2013-01-29 15:49:35 -08:00
Rafael Mendonça França
88e4ec6e32 Fix typo 2013-01-29 11:53:40 -02:00
Rafael Mendonça França
610958a0c0 Only search for enabled extension if the PostgreSQL version supports
extensions
2013-01-29 10:18:45 -02:00
Carlos Antonio da Silva
2cb576ef36 Refactor to use each_key, remove extra spaces 2013-01-28 23:25:03 -02:00
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