aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | Cleanup trailing whitespacesdfens2012-10-125-5/+5
| |
* | Merge pull request #7887 from senny/remove_unused_requires_in_ar_testsVijay Dev2012-10-104-4/+0
|\ \ | | | | | | remove duplicated require statements in AR test cases
| * | remove duplicated require statements in AR test casesYves Senn2012-10-094-4/+0
| | |
* | | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-10-112-2/+2
|\ \ \ | |_|/ |/| | | | | | | | | | | Conflicts: activerecord/lib/active_record/persistence.rb railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
| * | gradually moving documentation to new hash syntaxAvnerCohen2012-10-102-2/+2
| | |
* | | Merge pull request #7859 from ernie/fix-collection-associations-with-selectAaron Patterson2012-10-091-0/+8
|\ \ \ | |_|/ |/| | Fix has_many assocation w/select load after create
| * | Fix has_many assocation w/select load after createErnie Miller2012-10-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you create a new record via a collection association proxy that has not loaded its target, and which selects additional attributes through the association, then when the proxy loads its target, it will inadvertently trigger an ActiveModel::MissingAttributeError during attribute writing when CollectionAssociation#merge_target_lists attempts to do its thing, since the newly loaded records will possess attributes the created record does not. This error also raises a bogus/confusing deprecation warning when accessing the association in Rails 3.2.x, so cherry-pick would be appreciated!
| * | Revert "Use flat_map { } instead of map {}.flatten"Santiago Pastorino2012-10-053-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit abf8de85519141496a6773310964ec03f6106f3f. We should take a deeper look to those cases flat_map doesn't do deep flattening. irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten => [1, 3, 1, 2] irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i} => [[1, 3], [1, 2]]
| * | Use flat_map { } instead of map {}.flattenSantiago Pastorino2012-10-053-4/+4
| | |
* | | Move/rename files to follow naming conventionsAlexey Muranov2012-10-071-0/+0
| | |
* | | Rename "Fixtures" class to "FixtureSet"Alexey Muranov2012-10-078-37/+37
| | | | | | | | | | | | Rename `ActiveRecord::Fixtures` class to `ActiveRecord::FixtureSet`. Instances of this class normally hold a collection of fixtures (records) loaded either from a single YAML file, or from a file and a folder with the same name. This change make the class name singular and makes the class easier to distinguish from the modules like `ActiveRecord::TestFixtures`, which operates on multiple fixture sets, or `DelegatingFixtures`, `::Fixtures`, etc., and from the class `ActiveRecord::Fixture`, which corresponds to a single fixture.
* | | Remove unneeded requireRafael Mendonça França2012-10-061-1/+0
| | |
* | | Move multiparameter attributes related tests to its own fileRafael Mendonça França2012-10-062-337/+351
| | |
* | | PostgreSQL, quote table names when fetching the primary key. Closes #5920Yves Senn2012-10-051-0/+4
|/ /
* | Count returns 0 without querying if parent is not savedFrancesco Rodriguez2012-10-033-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patches `CollectionAssociation#count` to return 0 without querying if the parent record is new. Consider the following code: class Account has_many :dossiers end class Dossier belongs_to :account end a = Account.new a.dossiers.build # before patch a.dossiers.count # SELECT COUNT(*) FROM "dossiers" WHERE "dossiers"."account_id" IS NULL # => 0 # after a.dosiers.count # fires without sql query # => 0 Fixes #1856.
* | fix warning: method redefinedkennyj2012-10-022-2/+2
| |
* | Fix reset_counters() crashing on has_many :through associations.lulalala2012-10-023-2/+16
| | | | | | | | | | The counter column name in the intermediate model need to be access via the through reflection.
* | Change query pattern case insensitiveYasuo Honda2012-09-291-1/+1
|/ | | | because Oracle adapter uses upper case attribute/column name.
* Add an explicit test for hot compatibilityJon Leighton2012-09-281-0/+54
|
* Support for partial inserts.Jon Leighton2012-09-281-0/+25
| | | | | | | | | | | When inserting new records, only the fields which have been changed from the defaults will actually be included in the INSERT statement. The other fields will be populated by the database. This is more efficient, and also means that it will be safe to remove database columns without getting subsequent errors in running app processes (so long as the code in those processes doesn't contain any references to the removed column).
* Fix destructive side effects from marshaling an association caused by ↵Jeremy Kemper2012-09-251-2/+5
| | | | 65843e1acc0c8d285ff79f8c9c49d4d1215440be
* Skip tests for non-supported isolation levelsYasuo Honda2012-09-261-2/+6
| | | | | | | | i.e. Oracle database does not support these isolation levels. `:read_uncommitted` `:repeatable_read` This commit also works with other databases which do not support these isolation levels.
* Skip tests for non-supported isolation levels with OracleYasuo Honda2012-09-251-0/+2
|
* Fix collisions with before and after validation callbacks.John Foley2012-09-231-0/+49
| | | | | | This commit allows a user to do something like: before_validation :do_stuff, :on => [ :create, :update ] after_validation :do_more, :on => [ :create, :update ]
* Fix test_find_in_batches_should_use_any_column_as_primary_keySantiago Pastorino2012-09-221-11/+8
|
* start could be a stringSantiago Pastorino2012-09-211-2/+2
| | | | | Related to 761bc751d31c22e2c2fdae2b4cdd435b68b6d783 and eb876c4d07130f15be2cac7be968cc393f959c62
* Revert "Fix find_in_batches with customized primary_key"Santiago Pastorino2012-09-212-6/+5
| | | | | | | This reverts commit 761bc751d31c22e2c2fdae2b4cdd435b68b6d783. This commit wasn't fixing any issue just using the same table for different models with different primary keys.
* Style: remove hash noiseJeremy Kemper2012-09-211-10/+10
|
* Correct default charset/collation for mysql dbsJeremy Kemper2012-09-211-9/+21
|
* Make the serializable test much looserJon Leighton2012-09-211-18/+5
| | | | | It's too hard to test this properly, so let's just check that there are no errors.
* Support for specifying transaction isolation levelJon Leighton2012-09-211-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If your database supports setting the isolation level for a transaction, you can set it like so: Post.transaction(isolation: :serializable) do # ... end Valid isolation levels are: * `:read_uncommitted` * `:read_committed` * `:repeatable_read` * `:serializable` You should consult the documentation for your database to understand the semantics of these different levels: * http://www.postgresql.org/docs/9.1/static/transaction-iso.html * https://dev.mysql.com/doc/refman/5.0/en/set-transaction.html An `ActiveRecord::TransactionIsolationError` will be raised if: * The adapter does not support setting the isolation level * You are joining an existing open transaction * You are creating a nested (savepoint) transaction The mysql, mysql2 and postgresql adapters support setting the transaction isolation level. However, support is disabled for mysql versions below 5, because they are affected by a bug (http://bugs.mysql.com/bug.php?id=39170) which means the isolation level gets persisted outside the transaction.
* Merge pull request #5248 from ↵Jon Leighton2012-09-211-0/+16
|\ | | | | | | | | jcoleman/should-unset-association-when-an-existing-record-is-destroyed Unset association when existing record is destroyed.
| * Unset association when existing record is destroyed.James Coleman2012-03-021-0/+16
| | | | | | | | To avoid foreign key errors (and invalid data) in the database, when a belongs_to association is destroyed, it should also be nil'd out on the parent object.
* | Get rid of global variable in AR transactions testCarlos Antonio da Silva2012-09-201-7/+7
| |
* | rename AR::Model::Tag to AR::Tag - fixes #7714Francesco Rodriguez2012-09-201-2/+2
| |
* | fix querying with an empty hashDamien Mathieu2012-09-191-1/+10
| | | | | | | | Closes #6960
* | Merge pull request #7251 from rails/integrate-strong_parametersDavid Heinemeier Hansson2012-09-1816-1144/+59
|\ \ | | | | | | Integrate strong_parameters in Rails 4
| * | Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-166-83/+4
| | |
| * | Don't use assert_nothing_raised when assert_equal is usedGuillermo Iguaran2012-09-161-10/+6
| | |
| * | Rename ForbiddenAttributes exception to ForbiddenAttributesErrorGuillermo Iguaran2012-09-161-1/+1
| | |
| * | Add tests for ForbiddenAttributesProtection in ActiveRecordGuillermo Iguaran2012-09-161-0/+63
| | |
| * | Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-1613-1071/+6
| | |
* | | Merge pull request #7661 from ernie/build-join-records-on-unsaved-hmtRafael Mendonça França2012-09-171-0/+5
|\ \ \ | | | | | | | | Fix collection= on hm:t join models when unsaved
| * | | Fix collection= on hm:t join models when unsavedErnie Miller2012-09-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | If assigning to a has_many :through collection against an unsaved object using the collection=[<array_of_items>] syntax, the join models were not properly created, previously.
* | | | Fix warning: method redefine. Testcase name are duplicated.kennyj2012-09-171-1/+1
| |/ / |/| |
* | | Merge pull request #7547 from danmcclain/pg-arraysRafael Mendonça França2012-09-163-9/+115
|\ \ \ | | | | | | | | Adds migration and type casting support for PostgreSQL Array datatype
| * | | Moves column dump specific code to a module included in AbstractAdapterDan McClain2012-09-143-9/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having column related schema dumper code in the AbstractAdapter. The code remains the same, but by placing it in the AbstractAdapter, we can then overwrite it with Adapter specific methods that will help with Adapter specific data types. The goal of moving this code here is to create a new migration key for PostgreSQL's array type. Since any datatype can be an array, the goal is to have ':array => true' as a migration option, turning the datatype into an array. I've implemented this in postgres_ext, the syntax is shown here: https://github.com/dockyard/postgres_ext#arrays Adds array migration support Adds array_test.rb outlining the test cases for array data type Adds pg_array_parser to Gemfile for testing Adds pg_array_parser to postgresql_adapter (unused in this commit) Adds schema dump support for arrays Adds postgres array type casting support Updates changelog, adds note for inet and cidr support, which I forgot to add before Removing debugger, Adds pg_array_parser to JRuby platform Removes pg_array_parser requirement, creates ArrayParser module used by PostgreSQLAdapter
* | | | Merge pull request #7651 from steveklabnik/issue_3956Rafael Mendonça França2012-09-161-1/+31
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | Don't preserve SELECT columns on COUNT Closes #7651
| * | | Don't preserve SELECT columns on COUNTSteve Klabnik2012-09-161-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The COUNT clause of a finder_sql relationship is being rewritten from COUNT(*) to COUNT(table_name.*). This does not appear to be valid syntax in MySQL: ``` mysql> SELECT COUNT( table_name.* ) FROM `table_name`; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* ) FROM `table_name`' at line 1 ``` This fixes the bug, as well as adding tests so we don't re-introduce it in the future. Fixes #3956.
* | | | Don't explain except normal CRUD sql.kennyj2012-09-171-0/+7
| | | |