Commit Graph

520 Commits

Author SHA1 Message Date
Ben Woosley
31a43ebc10 Don't allow quote_value to be called without a column
Some adapters require column information to do their job properly.
By enforcing the provision of the column for this internal method
we ensure that those using adapters that require column information
will always get the proper behavior.
2013-07-22 04:49:18 -07:00
Ben Woosley
c083dc22dd Tidy up the "Specified column type for quote_value" changes
This includes fixing typos in changelog, removing a deprecated
mocha/setup test require, and preferring the `column_for_attribute`
accessor over direct access to the columns_hash in the new code.
2013-07-22 04:39:38 -07:00
Alfred Wong
39b5bfe239 Specified column type for quote_value
When calling quote_value the underlying connection sometimes requires
more information about the column to properly return the correct quoted
value.

I ran into this issue when using optimistic locking in JRuby and the
activerecord-jdbcmssql-adapter. In SQLSever 2000, we aren't allowed to
insert a integer into a NVARCHAR column type so we need to format it as
N'3' if we want to insert into the NVARCHAR type. Unfortuantely, without
the column type being passed the connection adapter cannot properly return
the correct quote value because it doesn't know to return N'3' or '3'.

This patch is fairly straight forward where it just passes in the column
type into the quote_value, as it already has the ability to take in the column,
so it can properly handle at the connection level.

I've added the tests required to make sure that the quote_value method
is being passed the column type so that the underlying connection can
determine how to quote the value.
2013-07-22 04:39:35 -07:00
Vipul A M
0b6c1f082f rescue from all exceptions in ConnectionManagement#call
Fixes #11497

As `ActiveRecord::ConnectionAdapters::ConnectionManagement` middleware does not rescue from Exception (but only from StandardError),
the Connection Pool quickly runs out of connections when multiple erroneous Requests come in right after each other.

Recueing from all exceptions and not just StandardError, fixes this behaviour.
2013-07-22 14:44:33 +05:30
Yves Senn
c212cfecb1 Revert "Merge pull request #11120 from awilliams/ar_mysql2_boolean_quoting"
This reverts commit cb1d07e43926bcec95cb8b4a663ca9889173395a, reversing
changes made to 754a373e301d2df0b12a11083405252722bc8366.
2013-07-17 09:51:22 +02:00
awilliams
41bd94b7ef Unifies mysql and mysql2 casting of booleans
Using the mysql2 adapter, boolean values were sometimes being incorrectly cast
to 't' or 'f'. This changes the cast to match the mysql adapter behavior, ie 1 and 0.
2013-07-16 12:14:09 +02:00
Yves Senn
754a373e30 change_column for PG adapter respects :array option. 2013-07-16 10:56:22 +02:00
Arun Agrawal
0d4075fb47 Remove deprecation warning from attribute_missing
for attributes that are columns.
2013-07-15 19:18:36 +02:00
Paul Nikitochkin
e0d59e6219 #4566: Remove extra decrement of transaction level
`rollback_active_record_state!` tries to restore model state on `Exception`
by invoking `restore_transaction_record_state` it decrement deep level by `1`.

After restoring it ensure that states to be cleared
and level decremented by invoking `clear_transaction_record_state`,
which cause the bug: because state already reduced in `restore_transaction_record_state`.

Removed double derement of transaction level
and removed duplicated code which clear transaction state for top level.
2013-07-14 20:35:31 +03:00
kennyj
33354aa23e Reset @column_defaults when assigning . 2013-07-14 03:02:47 +09:00
Rafael Mendonça França
7948d78905 Merge pull request #11306 from jetthoughts/11288_remove_extra_queries_for_belongs_to_with_touch
#11288: Removed duplicated touching

Conflicts:
	activerecord/CHANGELOG.md
2013-07-06 17:33:26 -03:00
Yves Senn
b54ef7ebde Revert "Merge pull request #11299 from arunagw/disable_implicit_join_references_removed"
`disable_implicit_join_references=` was only deprecated on `master`,
not with rails 4.0. We can remove it after 4.1

This reverts commit 3c719ead414ffd29e71efce185698af979052abb, reversing
changes made to d5c3bf9722abd5733a769c8d789de3f74dbfb92d.
2013-07-05 16:44:32 +02:00
Paul Nikitochkin
1ecc3e83b6 #11288: Removed duplicated touching
if belongs to model with touch option on touch

Closes #11288
2013-07-05 17:13:54 +03:00
Arun Agrawal
6dd7f7c04e Remove deprecated ActiveRecord::Base.disable_implicit_join_references=. 2013-07-04 19:48:42 +02:00
Yves Senn
8ee599ea86 Remove deprecated nil-passing to SchemaCache methods. 2013-07-04 10:40:52 +02:00
Yves Senn
6d554b263b Remove deprecated block filter from ActiveRecord::Migrator#migrate. 2013-07-04 10:09:12 +02:00
Yves Senn
685631285f Remove deprecated String constructor from ActiveRecord::Migrator. 2013-07-04 09:49:03 +02:00
Arun Agrawal
50cbc03d18 Remove deprecated scope use without passing a callable object.
Removed tests from deprecated code.
2013-07-03 23:23:11 +02:00
Arun Agrawal
9105c59af0 Remove deprecated transaction_joinable=
in favor of `begin_transaction`
with `:joinable` option.
2013-07-03 23:23:11 +02:00
Arun Agrawal
b23501112e Remove deprecated decrement_open_transactions. 2013-07-03 23:23:11 +02:00
Arun Agrawal
51c97e7e19 removed deprecated increment_open_transactions 2013-07-03 23:23:11 +02:00
Yves Senn
fca29750e4 remove deprecated PostgreSQLAdapter#outside_transaction? method. 2013-07-03 20:49:57 +02:00
Vipul A M
28d1d3f0fb Remove deprecated ActiveRecord::Fixtures.find_table_name in favour of ActiveRecord::Fixtures.default_fixture_model_name. 2013-07-03 15:28:05 +05:30
Neeraj Singh
0e8027fb34 Removed deprecated method columns_for_remove 2013-07-03 08:21:10 +05:30
Francesco Rodriguez
341b73965d Remove deprecated SchemaStatements#distinct 2013-07-02 16:41:17 -05:00
Yves Senn
eb5b7a8ced deprecated ActiveRecord::TestCase is no longer public.
/cc @tenderlove
2013-07-02 22:12:17 +02:00
Neeraj Singh
0e3700364c Dropped deprecated option :restrict for :dependent in associations 2013-07-03 00:56:20 +05:30
Neeraj Singh
8ef2463807 Removed support for deprecated delete_sql in associations. 2013-07-03 00:10:55 +05:30
Neeraj Singh
39ee74c405 Removed support for deprecated insert_sql in associations. 2013-07-02 23:38:46 +05:30
Neeraj Singh
d80334488f Removed support for deprecated finder_sql in associations. 2013-07-02 22:08:42 +05:30
Rafael Mendonça França
f875d319ad Add CHANGELOG enty for #11235 2013-07-02 11:50:15 -03:00
Neeraj Singh
4bf1ecd6d8 Removed support for deprecated counter_sql 2013-07-02 17:54:16 +05:30
Rafael Mendonça França
260c2015b3 Merge pull request #10604 from neerajdotname/delete_all_should_not_call_callbacks
Do not invoke callbacks when delete_all is called

Conflicts:
	activerecord/CHANGELOG.md
2013-07-01 23:41:32 -03:00
Neeraj Singh
71db2420a1 calling default_scope without a proc will raise ArgumentError
Calling default_scope without a proc will now raise `ArgumentError`.
2013-07-02 08:07:33 +05:30
Neeraj Singh
cfc54e417d Removed deprecated method type_cast_code from Column 2013-07-02 07:37:51 +05:30
Neeraj Singh
a8c888cca9 Removed deprecated options for assocations
Deprecated options `delete_sql`, `insert_sql`, `finder_sql` and `counter_sql`
have been deleted.
2013-07-02 06:22:25 +05:30
Yves Senn
a444ea3478 remove deprecated ActiveRecord::Base#connection method. 2013-07-01 22:44:24 +02:00
Yves Senn
dc9ff7bb7c remove auto-explain-config deprecation warning 2013-07-01 22:18:49 +02:00
Yves Senn
2181832fca Remove deprecated :distinct option from Relation#count. 2013-07-01 22:11:20 +02:00
Neeraj Singh
1f45d3c94d Removed deprecated methods partial_updates and family
Removed deprecated methods `partial_updates`, `partial_updates?` and
`partial_updates=`
2013-07-02 00:50:50 +05:30
Rafael Mendonça França
42cf96fe9c Merge pull request #11213 from neerajdotname/scoped-deprecated
Removed deprecated scoped method

Conflicts:
	activerecord/CHANGELOG.md
2013-07-01 15:48:29 -03:00
Neeraj Singh
b343abd875 Removed deprecated method scoped 2013-07-01 23:02:08 +05:30
Neeraj Singh
432cbc8419 Removed deprecated method default_scopes? 2013-07-01 22:59:46 +05:30
Neeraj Singh
f319e4a942 Do not invoke callbacks when delete_all is called
Method `delete_all` should not be invoking callbacks and this
feature was deprecated in Rails 4.0. This is being removed.
`delete_all` will continue to honor the `:dependent` option. However
if `:dependent` value is `:destroy` then the default deletion
strategy for that collection will be applied.

User can also force a deletion strategy by passing parameter to
`delete_all`. For example you can do `@post.comments.delete_all(:nullify)`
2013-06-30 14:50:18 +05:30
Yves Senn
22b3481ba2 remove deprecated implicit join references. 2013-06-29 10:50:44 +02:00
Jon Leighton
55193e449a Apply default scope when joining associations.
For example:

    class Post < ActiveRecord::Base
      default_scope -> { where published: true }
    end

    class Comment
      belongs_to :post
    end

When calling `Comment.join(:post)`, we expect to receive only
comments on published posts, since that is the default scope for
posts.

Before this change, the default scope from `Post` was not applied,
so we'd get comments on unpublished posts.
2013-06-28 11:47:00 +01:00
Łukasz Strzałkowski
3cc7223f3d Remove depreacted finders
They were deprecated in 4.0, planned to remove in 4.1
2013-06-28 00:24:11 +02:00
Carlos Antonio da Silva
96a083b51e Fix @tenderlove's name in changelog
[ci skip]
2013-06-26 00:57:19 -03:00
Carlos Antonio da Silva
dfafac9dfe Add changelog entry for database tasks removal #10853 [ci skip] 2013-06-25 20:58:43 -03:00
Carlos Antonio da Silva
840c552047 Merge pull request #10992 from Empact/find-each-enumerator
When .find_each is called without a block, return an Enumerator.
2013-06-25 20:09:17 -03:00