Commit Graph

9857 Commits

Author SHA1 Message Date
Neeraj Singh
4bf1ecd6d8 Removed support for deprecated counter_sql 2013-07-02 17:54:16 +05:30
Neeraj Singh
1a560e6160 Removing not useful test related to reflect_on_all_associations
The comment in the test pretty much summarizes the issue.
`FIXME these assertions bust a lot`

Adding any type of association in class `Firm` will break this test.

I removed some deprecated stuff and this test failed.

I do not think this test provides any useful value. First of all who
counted last that 39 is the right number of associations.

Secondly there are a large number of tests which depend on reflection
returning right information about associations. Those tests will start
failing if there is a bug in the code.
2013-07-02 12:14: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
Rafael Mendonça França
aa3ff85f47 Merge pull request #11230 from frodsan/remove_deprecated_clear_stale_cached_connections_method
Remove AR::Connection#clear_stale_cached_connections! deprecated method
2013-07-01 19:33:12 -07:00
Francesco Rodriguez
e7e49a0734 Remove deprecated AR::Connection#clear_stale_cached_connections! method 2013-07-01 21:12:51 -05:00
Neeraj Singh
cfc54e417d Removed deprecated method type_cast_code from Column 2013-07-02 07:37:51 +05:30
Aaron Patterson
1f75319a9a avoid intermediate zipped array 2013-07-01 18:06:25 -07:00
Aaron Patterson
6cd8e3f58e make the identity type a singleton to save on object creation 2013-07-01 18:00:52 -07:00
Aaron Patterson
b7aba569c8 only deal with strings internally 2013-07-01 17:56:47 -07:00
Rafael Mendonça França
11c2e80bab Merge pull request #11222 from neerajdotname/removed-deprecation-for-sql
Removed deprecated options for assocations
2013-07-01 17:55:20 -07:00
Aaron Patterson
6518f12b73 build an AST rather than slapping strings together 2013-07-01 17:54:40 -07:00
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
Carlos Antonio da Silva
1144d5e4a1 Remove deprecation messages about protected_attributes and rails-observers 2013-07-01 21:36:15 -03:00
Aaron Patterson
5cba5530ac stop exposing the underlying alias datastructure 2013-07-01 17:33:47 -07:00
Aaron Patterson
b9d98597cc we don't need to to_s the column 2013-07-01 16:55:10 -07:00
Aaron Patterson
d094aaad19 the data structure used to store attribute aliases should not be exposed 2013-07-01 16:23:08 -07:00
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
Yves Senn
162cc66864 don't shadow through_scope method name with local var. 2013-06-30 14:40:45 +02:00
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
Carlos Antonio da Silva
8f63515f6e Merge pull request #11161 from dmitry/find_in_batches_works_without_logger
ActiveRecord find_in_batches should work without logger

When I set logger to nil both methods from Batches module find_in_batches or find_each should work anyway.
2013-06-28 06:00:20 -07:00
Carlos Antonio da Silva
5e6de3942f Remove order_values argument now that default_scope is simplified
In 94924dc32baf78f13e289172534c2e71c9c8cade the internal default_scope
implementation has changed making it simpler to follow, meaning that the
old usage of with_default_scope has been removed.

With that, order_values was the same argument for both calls to
find_first_with_limit, so remove it and use the existent attribute
for the sake of clarity/simplification.
2013-06-28 09:51:14 -03:00
Dmitry Polushkin
1cf6871a9e find_in_batches should work without logger 2013-06-28 13:51:00 +01:00
Jon Leighton
94924dc32b Simplify/fix implementation of default scopes
The previous implementation was necessary in order to support stuff
like:

    class Post < ActiveRecord::Base
      default_scope where(published: true)
      scope :ordered, order("created_at")
    end

If we didn't evaluate the default scope at the last possible moment
before sending the SQL to the database, it would become impossible to
do:

    Post.unscoped.ordered

This is because the default scope would already be bound up in the
"ordered" scope, and therefore wouldn't be removed by the
"Post.unscoped" part.

In 4.0, we have deprecated all "eager" forms of scopes. So now you must
write:

    class Post < ActiveRecord::Base
      default_scope { where(published: true) }
      scope :ordered, -> { order("created_at") }
    end

This prevents the default scope getting bound up inside the "ordered"
scope, which means we can now have a simpler/better/more natural
implementation of default scoping.

A knock on effect is that some things that didn't work properly now do.
For example it was previously impossible to use #except to remove a part
of the default scope, since the default scope was evaluated after the
call to #except.
2013-06-28 13:45:57 +01: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
Jon Leighton
4642f5487a Fix test
Oops. We need to estalish/remove the connection in the setup/teardown,
else it messes with the fixtures.
2013-06-28 11:46:03 +01:00
Jon Leighton
cb8c950333 Fix rake test_sqlite3_mem
Clearly nobody uses this except me. It's fast people!
2013-06-28 11:37:42 +01:00
Jon Leighton
2ea7183799 Merge pull request #11153 from strzalek/remove-ar-deprecated-finders
Remove depreacted finders
2013-06-28 02:13:06 -07:00
Akira Matsuda
569227b091 Fix indentation 2013-06-28 16:39:43 +09: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
Łukasz Strzałkowski
468939297d Remove deprecated attr_protected/accessible
Rails 4.0 has removed attr_protected and attr_accessible feature in favor of Strong Parameters.
2013-06-27 20:38:30 +02:00
tumayun
e82f206a94 activerecord/examples/simple.rb use master branch activesupport gem 2013-06-27 23:17:34 +08:00
tumayun
f6f373db9b fix activerecord/examples/performance.rb#L101 syntax error 2013-06-27 01:49:54 +08:00
wangjohn
36c89664f5 Moving the pluck and ids methods to their own delegate line.
These two methods aren't really statistical helper methods and don't
really belong in any other group which is being delegated for querying,
so I'm moving them to their own group of methods.

I've also changed the `:to => :all` hash syntax to `to: :all`.
2013-06-25 21:40:58 -07: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
37bacd3df2 Merge pull request #10730 from tkhr/add_test_for_AR__CounterCache#update_counters
Add test for AR::CounterCache.update_counters
2013-06-25 17:29:33 -07: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
370e1ad3f1 Merge pull request #10853 from kennyj/deprecated-database_tasks
Remove Oracle / Sqlserver / Firebird database tasks were deprecated since 4.0.
2013-06-25 16:56:39 -07: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
Carlos Antonio da Silva
755069ee4e Merge pull request #10993 from Empact/result-each-enumerator
Change Result#each to return an Enumerator when called without a block.
2013-06-25 20:07:59 -03:00
Carlos Antonio da Silva
f02d4ddc99 Merge pull request #11046 from arunagw/verbose_mode_on
Verbose mode on when running tests
2013-06-25 15:15:43 -07:00
Anton Kalyaev
512f03e740 removed unnecessary mapping for on options
Right before that in `assert_valid_transaction_action` method we make
sure that `options[:on]` contains values from `ACTIONS` array
(`[:create, :destroy, :update]`) and nothing more (i.e. it could not
contain strings or something else, otherwise the error is raised).

Also I've polished some docs.
2013-06-25 22:31:14 +04:00
Yves Senn
aaad6b6e13 remove trailing whitespace from Active Record CHANGELOG 2013-06-25 10:12:10 +02:00