Commit Graph

6598 Commits

Author SHA1 Message Date
Xavier Noria
1be9830d4d add the query to AR::Relation#explain output
Rationale: this is more readable if serveral queries
are involved in one call. Also, it will be possible
to let AR log EXPLAINs automatically in production
mode, where queries are not even around.
2011-11-25 14:29:34 -08:00
José Valim
8896b4fdc8 Implement ArraySerializer and move old serialization API to a new namespace.
The following constants were renamed:

  ActiveModel::Serialization     => ActiveModel::Serializable
  ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON
  ActiveModel::Serializers::Xml  => ActiveModel::Serializable::XML

The main motivation for such a change is that `ActiveModel::Serializers::JSON`
was not actually a serializer, but a module that when included allows the target to be serializable to JSON.

With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
2011-11-23 23:18:15 +00:00
Aaron Patterson
5d704fa152 oops! I suck! 💣 2011-11-20 15:11:11 -08:00
Aaron Patterson
008abd17dc fixing tests on ruby 1.8 2011-11-20 15:09:03 -08:00
Arun Agrawal
be9d3a2008 Bump Arel 2011-11-20 12:27:25 +05:30
Aaron Patterson
599d7c40a4 removing deprecated methods 2011-11-19 20:43:04 -08:00
Aaron Patterson
24fa524cef adding visitors to the respective adapters 2011-11-19 20:28:41 -08:00
Aaron Patterson
bd2f5c062d pushing caching and visitors down to the connection 2011-11-19 20:19:53 -08:00
Jon Leighton
fec85cf10d Perf fix
If we're deleting all records in an association, don't add a IN(..)
clause to the query.

Fixes #3672.
2011-11-19 14:11:29 +00:00
Jon Leighton
2ef4947ab0 Add missing CHANGELOG entry for #3678. Closes #3678. 2011-11-19 13:34:50 +00:00
Jon Leighton
11afb74089 Merge pull request #3687 from kennyj/fix_3678-2
Use `show index from`. We could fix `pk_and_sequence_for` method's performance problem (GH #3678)
2011-11-19 05:00:37 -08:00
Jon Leighton
9c37416a3e Verify that #3690 has been closed by previous changes to the mysql
adapters.

These tests fail on the v3.1.2 tag.

Closes #3690.
2011-11-19 12:34:15 +00:00
kennyj
f9b9179016 Use show index from. We could fix pk_and_sequence_for method's performance problem (GH #3678) 2011-11-19 04:19:31 +09:00
Christos Zisopoulos
280b2b725b Only used detailed schema introspection when doing a schema dump.
Fixes #3678
2011-11-18 18:29:47 +01:00
Sam Ruby
42954c426b Stop db:seed from performing a reload of the db
Fix regression introduced by 38d26b0cb5
2011-11-18 10:05:06 -05:00
Vijay Dev
1c4564b620 Merge pull request #3666 from oscardelben/databases_rake_cleanup
Cleanup of databases.rake psql env variables
2011-11-18 04:21:56 -08:00
Aaron Patterson
a2f14e2344 Revert "Merge pull request #1163 from amatsuda/sexier_migration_31"
This reverts commit 0e407a9041, reversing
changes made to 533a9f84b0.

Conflicts:

	activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
	activerecord/test/cases/migration_test.rb
2011-11-17 10:29:28 -08:00
Aaron Patterson
649f2513a4 Revert "Merge pull request #3603 from vijaydev/change_table_without_block_arg"
This reverts commit 81fad6a270, reversing
changes made to 23101de283.

Conflicts:

	activerecord/test/cases/migration_test.rb
2011-11-17 10:29:28 -08:00
Oscar Del Ben
a89fabbb02 Cleanup of databases.rake psql env variables 2011-11-17 18:49:47 +01:00
Arun Agrawal
5ccd9bcc1a No need to readlines then join, just use read ❤️
same as 4c1a1933cb
2011-11-17 12:24:40 +05:30
Aaron Patterson
4c1a1933cb No need to readlines then join, just use read ❤️ 2011-11-16 16:18:00 -08:00
Aaron Patterson
bb95e81538 Adding a deprecation warning for use of the schema_info table. 2011-11-16 15:51:25 -08:00
Aaron Patterson
97ca6358c5 Join method uses empty string by default, so remove it 2011-11-16 15:40:20 -08:00
Aaron Patterson
b96aaf8ccb dbfile isn't supported anymore, so remove 2011-11-16 15:31:37 -08:00
Aaron Patterson
ca69408b49 Reduce schema format tests 2011-11-16 15:31:37 -08:00
Aaron Patterson
38d26b0cb5 Move conditionals to separate tasks so they can be reused. 2011-11-16 15:31:37 -08:00
James Adam
73cb0f9828 ActiveRecord::Base#becomes should retain the errors of the original object.
This commit contains a simple failing test that demonstrates the behaviour we expect, and a fix. When using `becomes` to transform the type of an object, it should retain any error information that was present on the original instance.
2011-11-16 23:19:58 +00:00
Aaron Patterson
cef1e14e09 removing some useless conditionals 2011-11-16 14:46:20 -08:00
Aaron Patterson
43821bf351 Merge pull request #2948 from atambo/master
schema_format :sql should behave like schema_format :ruby
2011-11-16 14:37:24 -08:00
Aaron Patterson
61228e9a0c fixing tests on PG 2011-11-16 13:25:55 -08:00
Ryan Naughton
63a22ca616 Fixes issue #3483, regarding using a mixture of ranges and discrete values in find conditions. Paired with Joey Schoblaska. 2011-11-14 21:43:27 -06:00
Gabriel Sobrinho
e1b79c56be Failing test case for issue #3483 2011-11-14 21:39:03 -06:00
José Valim
9fa329b754 Speed up attribute invocation by checking if both name and calls are compilable. 2011-11-14 20:12:17 +01:00
Aaron Patterson
11c9fc9364 Merge pull request #3371 from yahonda/fix_ora_00932_error
Fix ORA-00932 error when trying to insert 0 to DATE type columns.
2011-11-14 04:36:55 -08:00
Jon Leighton
da02f792fe Sync CHANGELOGs from 3-1-stable 2011-11-14 11:28:12 +00:00
Noé Froidevaux
bf6efa8d9c Fix pull request #3609 2011-11-13 11:03:22 +01:00
Noé Froidevaux
27c5800c9c Prevent multiple SHOW TABLES calls when a table don't exists in database. 2011-11-11 12:09:51 +01:00
Vijay Dev
2e5c4717ba change_table bulk test case should check if the connection supports bulk alter 2011-11-11 12:47:03 +05:30
Vijay Dev
6e112e4217 Modify change_table to remove the need for the block argument. 2011-11-11 02:47:27 +05:30
Vijay Dev
b805c71655 Checking the arity of the block passed to create_table
A recent change made to create_table does away with the
need for the block argument. Checking the arity will prevent the
mixing up of the two syntaxes.
2011-11-10 22:55:13 +05:30
Akira Matsuda
74c6e80cab exclude ORDER BY clause when querying Relation#exists? 2011-11-09 04:51:11 +09:00
Vijay Dev
cff1d751d0 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	railties/guides/source/active_record_querying.textile
2011-11-08 21:35:17 +05:30
Xavier Noria
17ecdd388c adds trailing +s to the output of EXPLAIN for MySQL 2011-11-07 02:01:56 -08:00
Xavier Noria
b454601be4 revises EXPLAIN tests for SQLite3
The output in Travis is a bit different. The SQLite
documentation (http://www.sqlite.org/eqp.html) warns
output may change dramatically between releases. I
do not want to mock the result set because I want a
real EXPLAIN to happen. I prefer a test that may fail
in future releases than a test that may give false
positives in future releases.
2011-11-06 22:21:05 -08:00
Akira Matsuda
aff9e68cb5 document fix: remove_column takes multiple column_names 2011-11-07 14:03:33 +09:00
Akira Matsuda
55b203dac1 self.up, self.down => up, down 2011-11-07 11:56:50 +09:00
Aaron Patterson
9b46613780 Merge pull request #3521 from nulogy/fix_postgres_adapter_to_handle_spaces_between_schemas
Fix postgres adapter to handle spaces between schemas
2011-11-06 13:16:07 -03:00
Justin Mazzi
c7d2078596 Update ActiveRecord#attribute_present? to work as documented
"Returns true if the specified attribute has been set by the user or by
a database load and is neither nil nor empty?"

Fixes #1613
2011-11-05 22:36:19 -04:00
Xavier Noria
e7b7b44123 implements AR::Relation#explain
This is a first implementation, EXPLAIN is highly
dependent on the database and I have made some
compromises.

On one hand, the method allows you to run the most
common EXPLAIN and that's it. If you want EXPLAIN
ANALYZE in PostgreSQL you need to do it by hand.

On the other hand, I've tried to construct a string
as close as possible to the ones built by the
respective shells. The rationale is that IMO the
user should feel at home with the output and
recognize it at first sight. Per database.

I don't know whether this implementation is going
to work well. Let's see whether people like it.
2011-11-05 18:30:19 -07:00
Jon Leighton
f575e21025 Merge pull request #3525 from kennyj/fix_3440-1
Fixed an issue id false option is ignored on mysql/mysql2 (fix #3440)
2011-11-05 10:29:18 -07:00