Commit Graph

3182 Commits

Author SHA1 Message Date
Jon Leighton
1defb6adb8 Fix schema_cache_test.rb for sqlite3_mem 2011-11-29 12:29:42 +00:00
Aaron Patterson
dde2113867 Move connection resoluion logic to it's own testable class. 2011-11-28 15:23:25 -08:00
Aaron Patterson
ffb218c750 pools are 1:1 with spec now rather than 1:1 with class 2011-11-28 15:23:25 -08:00
Aaron Patterson
2a9a8ad4df break establish_connection to smaller methods 2011-11-28 15:23:24 -08:00
Aaron Patterson
ba0b3eee14 Merge pull request #3768 from janv/master
Test and fix for Issue 3450
2011-11-28 09:35:43 -08:00
Jan Varwig
cba5a3a367 Test case and fix for rails/rails#3450
Asssigning a parent id to a belongs_to association actually updates the object that is validated when the association has :validates => true
2011-11-27 22:29:56 +01:00
Jon Leighton
b00cf122e2 Merge pull request #3748 from samsonasu/has_many_custom_pk_new_record
New records should load has_many relationships with custom primary keys
2011-11-27 13:05:19 -08:00
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
Brian Samson
0f5104d720 load has_many associations keyed off a custom primary key if that key is present but the record is unsaved 2011-11-25 08:24:54 -07:00
Aaron Patterson
008abd17dc fixing tests on ruby 1.8 2011-11-20 15:09:03 -08:00
Aaron Patterson
bd2f5c062d pushing caching and visitors down to the connection 2011-11-19 20:19:53 -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
Aaron Patterson
a2f14e2344 Revert "Merge pull request #1163 from amatsuda/sexier_migration_31"
This reverts commit 0e407a90413d8a19002b85508d811ccdf2190783, reversing
changes made to 533a9f84b035756eedf9fdccf0c494dc9701ba72.

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 81fad6a270ec3cbbb88553c9f2e8200c34fd4d13, reversing
changes made to 23101de283de13517e30c4c3d1ecc65525264886.

Conflicts:

	activerecord/test/cases/migration_test.rb
2011-11-17 10:29:28 -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
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
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
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
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
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
kennyj
fb0bf3c984 Fixed an issue id false option is ignored on mysql/mysql2 (fix #3440) 2011-11-06 02:15:47 +09:00
Jon Leighton
562583c766 Add ActiveRecord::Relation#uniq for toggling DISTINCT in the SQL query 2011-11-05 16:22:18 +00:00
Vlad Jebelev
69dcd45aea AR changes to support creating ordered (asc, desc) indexes 2011-11-04 15:45:24 -05:00
Arun Agrawal
6da558660c Fix test as one more has_many added 2011-11-04 19:30:59 +05:30
Jon Leighton
e6cc2ea201 Allow the :class_name option for associations to take a symbol.
This is to avoid confusing newbies, and to be consistent with the fact
that other options like :foreign_key already allow a symbol or a string.
2011-11-04 11:17:56 +00:00
Aaron Patterson
0e407a9041 Merge pull request #1163 from amatsuda/sexier_migration_31
Sexier migrations
2011-11-04 03:29:59 -07:00
Jeremy Kemper
533a9f84b0 Merge pull request #3507 from jmazzi/issue-3503
Preserve SELECT columns on the COUNT for finder_sql when possible
2011-11-03 21:17:15 -07:00
Jon Leighton
d486103570 Fix #3271.
Building the conditions of a nested through association could
potentially modify the conditions of the through and/or source
association.

This is a Bad Thing.
2011-11-03 15:12:08 +00:00
Jon Leighton
19b2a5f2bd Remove all revelant through records.
If a record is removed from a has_many :through, all of the join records
relating to that record should also be removed from the through
association's target.

(Previously the records were removed in the database, but only one was
removed from the in-memory target array.)
2011-11-03 13:13:13 +00:00
Jon Leighton
71bc921ec8 Fix adding multiple instances of the same record to a has_many :through.
Fixes #3425.
2011-11-03 12:39:05 +00:00
Jon Leighton
b4b178f7e9 Fix #3247.
Fixes creating records in a through association with a polymorphic source
type.
2011-11-03 10:23:42 +00:00
Vijay Dev
1afe269a4a assert_match takes a regexp and a string in that order 2011-10-31 19:01:03 +05:30
Laust Rud Jacobsen
ff9c2799c1 dump_schema_information: explicitly order inserts into schema_migrations table
This change reduces churn in the db/development_structure.sql file when using :sql as
active_record.schema_format, and makes comparing diffs much easier.

Test ensures the output SQL-statements are lexically ordered by version.
2011-10-31 10:36:13 +01:00
Joe Van Dyk
420f7fd507 Added failing test case for changing schema in migration not clearing the prepared statement cache 2011-10-27 10:50:38 -07:00
Arun Agrawal
95d9c120d3 More checks for instance writers. 2011-10-27 16:25:50 +05:30
Arun Agrawal
80fc29f36f Adding more checks for instance_writer false 2011-10-27 15:47:56 +05:30
Arun Agrawal
485b99611b Test fix Allow instances to disable record_timestamps
Removed here 0d0176c4ffe5c58fd1002efbd8f7bd45a8872e33
2011-10-27 15:41:15 +05:30
Pratik Naik
0d0176c4ff Allow instances to disable record_timestamps 2011-10-26 18:20:12 +01:00
David Heinemeier Hansson
1d9ab88ee6 Merge branch 'master' of github.com:rails/rails 2011-10-25 17:22:55 -05:00
David Heinemeier Hansson
5daf07704a Fix that changing a store should mark the store attribute as changed 2011-10-25 17:22:52 -05:00
Greg Reinacker
f092be821d preserve decimal column attributes after migration 2011-10-21 17:30:39 -06:00
Aaron Patterson
ee9d9fb5fa Merge pull request #3258 from ileitch/3-1-stable
Postgres: Do not attempt to deallocate a statement if the connection is no longer active.
2011-10-20 08:45:22 -07:00