aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
* Add test to column alias in `exists?` SQL.Rafael Mendonça França2012-06-101-0/+6
| | | | | | | | This behavior was added in dd286a4c735dac1db8c9262581c7f29c44d1f695 Closes #1139. Fixes #2553, #1141, #1623 and #2062.
* Merge pull request #6695 from kennyj/fix_6635Rafael Mendonça França2012-06-101-0/+9
| | | | Fix #6635. We should call Scoping methods, before calling Array methods.
* Make test cover previous reversionJon Leighton2012-06-071-0/+1
|
* Revert "Perf: Don't load the association for #delete_all."Jon Leighton2012-06-071-12/+0
| | | | | | | | | | This reverts commit b98d1e21635d8776de8893cc09bd86c71f6c78f0. Closes #6609 Conflicts: activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
* Add failing test for 3.2.5 datetime attribute regressionEvan Arnold2012-06-041-0/+11
|
* Skip test_remove_column_with_array_as_an_argument_is_deprecated with Oracle ↵Yasuo Honda2012-06-021-1/+3
| | | | | | | adapter. Because Oracle adapter supports only remove_column :table_name, :column_name syntax and it has never supported remove_column :table_name, [:column_name].
* Restore behavior of Active Record 3.2.3 scopesAndrew White2012-06-012-26/+0
| | | | | | | | | | | | | | A series of commits relating to preloading and scopes caused a regression. Cloning the relation calls initialize_copy which resets a number of instance variables to nil. Without this the scope thinks that it is already loaded when it is called again. Reverts the following commits: 13f1401a6cf0266a3b0a91b173f976db2d4e50f3 8491740ca5361ba9df20e1c8b906c709f5bfbc12 dffbb521a0d00c8673a3ad6e0e8ff526f32daf4e Fixes #6575, #6576 & #6577
* Merge branch '3-2-stable-sec' into 3-2-stableAaron Patterson2012-05-311-0/+19
|\ | | | | | | | | | | | | * 3-2-stable-sec: Strip [nil] from parameters hash. Thanks to Ben Murphy for reporting this! predicate builder should not recurse for determining where columns. Thanks to Ben Murphy for reporting this bumping to 3.2.4.rc1
| * predicate builder should not recurse for determining where columns.Aaron Patterson2012-05-301-0/+19
| | | | | | | | | | | | Thanks to Ben Murphy for reporting this CVE-2012-2661
* | Merge pull request #5810 from kennyj/fix_5797Aaron Patterson2012-05-301-0/+9
|/ | | | | | Fix #5797. Error calling dup method on AR model with serialized field Conflicts: activerecord/lib/active_record/core.rb
* Fixes the build break caused by 9ee8528 in #6445.Godfrey Chan2012-05-221-2/+4
| | | | | | | | Ruby 1.8 raises a TypeError when trying to modify a frozen Hash, while Ruby 1.9 raises a RuntimeError instead. Also, Ruby < 1.9.3 uses a lowercase 'hash' in the exception message while Ruby >= 1.9.3 uses an uppercase 'Hash' instead. This commit normalizes those issues in the test case.
* Restore the frozen state on rollback. Fixes #6417.Godfrey Chan2012-05-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | This is a 3-2-stable backport for #6420 which was merged into master. Currently, when saving a frozen record, an exception would be thrown which causes a rollback. However, there is a bug in active record that "defrost" the record as a side effect: >> t = Topic.new => #<Topic id: nil, ...> >> t.freeze => #<Topic id: nil, ...> >> t.save RuntimeError: can't modify a frozen Hash >> t.frozen? => false >> t.save => true This patch fixes the bug by explictly restoring the frozen state on the attributes Hash after every rollback.
* Postgresql doesn't accept limits on binary (bytea) columns.Victor Costan2012-05-211-0/+1
|
* Fix `validates_uniqueness_off :field, :allow_nil => false`Piotr Sarnacki2012-05-191-0/+11
| | | | | | | | | | | | | | | | | | Closes (#5853) Uniqueness validator was not properly checking if there are any existing records, when value was `nil` and column was text type. `nil` was converted to string, which resulted in queries looking like: ```sql SELECT 1 FROM "posts" WHERE "posts"."title" = '' LIMIT 1 ``` instead of ```sql SELECT 1 FROM "posts" WHERE "posts"."title" IS NULL LIMIT 1 ```
* Ensure that CollectionAssociation#replace returns proper targetPiotr Sarnacki2012-05-191-2/+2
| | | | | | | | The fix commited in e2a070c was returning the `new_target`, as a try to return whatever user replaced association with. The problem is, the resulting association target may be ordered differently. In such case we want to return the target that will be later used for that association.
* fix #delete_all with habtm with :delete_sqlJon Leighton2012-05-181-0/+6
|
* Perf: Don't load the association for #delete_all.Jon Leighton2012-05-181-0/+12
| | | | | | | | Bug #6289 Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Fix CollectionAssociation#replace to return new target (closes #6231)Piotr Sarnacki2012-05-161-0/+12
| | | | | | Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
* Return false for exists? with new records - fixes #6199.Andrew White2012-05-102-0/+2
| | | | (cherry picked from commit fa21b73ebb8339ad388f149c817c433b6254d490)
* Fix buildFrancesco Rodriguez2012-05-091-1/+9
|
* Merge pull request #6128 from frodsan/delete_all_limit_32Aaron Patterson2012-05-041-0/+4
|\ | | | | Fix #4979 against 3-2-stable
| * Fix #4979 against 3-2-stable - delete_all raise an error if a limit is providedFrancesco Rodriguez2012-05-021-0/+4
| |
* | Deprecate remove_column with array as an argumentPiotr Sarnacki2012-05-021-0/+6
|/
* Add extra order clause to fix failing test on Ruby 1.8.7Carlos Antonio da Silva2012-04-241-1/+1
|
* Fix build. It seems that the Mocha's behavior were changed.kennyj2012-04-242-3/+9
|
* Be sure to correctly fetch PK name from MySQL even if the PK has some custom ↵Akira Matsuda2012-04-191-0/+30
| | | | | | | | | | | option Backports #5900 Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb
* Adds test to check that circular preloading does not modify Model.unscoped ↵Benedikt Deicke2012-04-193-4/+26
| | | | | | | | (as described in #5667) Conflicts: activerecord/test/cases/associations/eager_test.rb
* Removes caching from ActiveRecord::Core::ClassMethods#relationBenedikt Deicke2012-04-191-0/+4
| | | | | | | | | | | | | | | The #relation method gets called in four places and the return value was instantly cloned in three of them. The only place that did not clone was ActiveRecord::Scoping::Default::ClassMethods#unscoped. This introduced a bug described in #5667 and should really clone the relation, too. This means all four places would clone the relation, so it doesn't make a lot of sense caching it in the first place. The four places with calls to relations are: activerecord/lib/active_record/scoping/default.rb:110:in `block in build_default_scope'" activerecord/lib/active_record/scoping/default.rb:42:in `unscoped'" activerecord/lib/active_record/scoping/named.rb:38:in `scoped'" activerecord/lib/active_record/scoping/named.rb:52:in `scope_attributes'" Conflicts: activerecord/lib/active_record/core.rb
* Revert "Fix #5667. Preloading should ignore scoping."Jeremy Kemper2012-04-181-11/+0
| | | | | | | | Causes a subtle regression where record.reload includes the default scope. Hard to reproduce in isolation. Seems like the relation is getting infected by some previous usage. This reverts commit dffbb521a0d00c8673a3ad6e0e8ff526f32daf4e.
* Fix tests of benchmark with silence equals to trueRafael Mendonça França2012-04-041-3/+1
|
* Merge pull request #5662 from arturopie/3-2_fixing_IM_when_using_find_selectAaron Patterson2012-03-301-11/+6
|\ | | | | Fixing Identity Map when using find select in rails 3.2
| * refactor the checking of the attributes of the record in IdentityMap#add, so ↵Arturo Pie2012-03-291-4/+5
| | | | | | | | it's more readable
| * Adds a test that breaks IM when using #selectArturo Pie2012-03-291-12/+6
| |
* | Fix #5667. Preloading should ignore scoping.Jon Leighton2012-03-301-0/+11
|/ | | | | | Conflicts: activerecord/test/cases/associations/eager_test.rb
* Merge pull request #5640 from yahonda/address_ora_00918_with_oracleSantiago Pastorino2012-03-281-1/+1
|\ | | | | Address an error for test_has_many_through_polymorphic_has_one with Oracle
| * Change the order argument from ('id') to ('taggings.id')Yasuo Honda2012-03-281-1/+1
| | | | | | | | to address ORA-00918 error
* | Test for #5549.Aaron Patterson2012-03-282-1/+16
| | | | | | | | | | | | | | | | Cherry-picked from e96d04a2e4e244ea5053cb4e8ab97db604d0c796. Conflicts: activerecord/lib/active_record/attribute_methods/read.rb
* | force datetime attributes to be changedSergey Nartimov2012-03-271-0/+14
|/ | | | backport ddb5d2f756d9d2655a07791a3b62832efd588474 to 3-2-stable
* Merge pull request #5537 from kennyj/fix_4399-32Aaron Patterson2012-03-231-0/+12
|\ | | | | [3-2-stable] migrate(:down) method with table_name_prefix
| * migrate(:down) method with table_name_prefixkennyj2012-03-211-0/+12
| |
* | Fix identity map testsCarlos Antonio da Silva2012-03-231-16/+16
| |
* | Add order to tests that rely on db ordering, to fix failing tests on pgCarlos Antonio da Silva2012-03-2213-46/+45
|/ | | | | | | Also skip persistente tests related to UPDATE + ORDER BY for postgresql PostgreSQL does not support updates with order by, and these tests are failing randomly depending on the fixture loading order now.
* Merge pull request #5437 from kennyj/fix_5430Aaron Patterson2012-03-151-0/+7
| | | | Fix GH #5430. A Payload name for schema_search_path should be SCHEMA.
* [3-2-stable] Fix GH #5399. connection_pools's keys are ↵kennyj2012-03-141-1/+7
| | | | ActiveRecord::Base::ConnectionSpecification objects.
* fix activerecord query_method regression with offset into FixnumDenis Jean2012-03-131-0/+4
| | | | | | add test to show offset query_methods on mysql & mysql2 change test to cover public API
* make sure connections returned after close are marked as in_useAaron Patterson2012-03-121-0/+10
|
* Add dynamic find_or_create_by_{attribute}! method.Andrew White2012-03-124-0/+52
| | | | | | | | | (cherry picked from commit 5282485d310d1a6ffcf55e4e7f56ab234e16880d) Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/dynamic_finder_match.rb
* Not need to pass join attributes to association buildRafael Mendonça França2012-03-083-12/+11
|
* Add test case to has_many through association when mass_assignment_sanitizer isRafael Mendonça França2012-03-084-4/+34
| | | | | | | | :strict Conflicts: activerecord/test/models/person.rb
* ensure that released connections move between threadsAaron Patterson2012-03-081-0/+18
|