aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Remove update_attribute.Steve Klabnik2012-06-144-66/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically, update_attribute and update_attributes are similar, but with one big difference: update_attribute does not run validations. These two methods are really easy to confuse given their similar names. Therefore, update_attribute is being removed in favor of update_column. See the thread on rails-core here: https://groups.google.com/forum/?fromgroups#!topic/rubyonrails-core/BWPUTK7WvYA
* | | | Need a assert here in testsArun Agrawal2012-06-121-2/+2
| | | |
* | | | Merge pull request #6676 from aurelian/masterRafael Mendonça França2012-06-121-0/+4
|\ \ \ \ | |/ / / |/| | | Don't assign the attributes if the list is empty
| * | | Don't assign the attributes if the list is empty.Aurelian Oancea2012-06-081-0/+4
| | | |
* | | | Remove warnings and unused codeRafael Mendonça França2012-06-112-7/+2
| | | |
* | | | No need to cache table metadata in advance now that #6683 was merged.Rafael Mendonça França2012-06-112-16/+0
| | | |
* | | | Merge pull request #6492 from pmahoney/fair-connection-pool2Rafael Mendonça França2012-06-114-1/+112
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fair connection pool2 Conflicts: activerecord/test/cases/associations/eager_test.rb
| * | | | Make connection pool fair with respect to waiting threads.Patrick Mahoney2012-05-253-1/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The core of this fix is a threadsafe, fair Queue class. It is very similar to Queue in stdlib except that it supports waiting with a timeout. The issue this solves is that if several threads are contending for database connections, an unfair queue makes is possible that a thread will timeout even while other threads successfully acquire and release connections. A fair queue means the thread that has been waiting the longest will get the next available connection. This includes a few test fixes to avoid test ordering issues that cropped up during development of this patch.
| * | | | Cache metadata in advance to avoid extra sql statements while testing.Yasuo Honda2012-05-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Reason: If metadata is not cached extra sql statements will be executed, which causes failures tests with assert_queries().
* | | | | Merge pull request #6709 from amatsuda/sqlite3_version_is_always_gt_125Rafael Mendonça França2012-06-111-1/+1
|\ \ \ \ \ | | | | | | | | | | | | current AR::ConnectionAdapters::SQLite3Adapter supports only SQLite3 ~> 1.3.6
| * | | | | current AR::ConnectionAdapters::SQLite3Adapter supports only SQLite3 ~> 1.3.6Akira Matsuda2012-06-121-1/+1
| | | | | |
* | | | | | TimeZone format is always /[+-]\d{2}:\d{2}/ in Ruby 1.9Akira Matsuda2012-06-121-1/+1
|/ / / / /
* | | | | Address ORA-00911 errors because of the heading underscore.Yasuo Honda2012-06-111-1/+1
| | | | |
* | | | | Fix that #exists? raises ThrowResult when called with an empty limitedBen Woosley2012-06-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reflection. ActiveRecord::FinderMethods#construct_limited_ids_condition will raise ThrowResult if the limited reflection comes back empty. The other callers of #construct_limited_ids_condition handle this exception (more specifically, the callers of construct_relation_for*), but #exists? didn't until now.
* | | | | Add test to column alias in `exists?` SQL.Rafael Mendonça França2012-06-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This behavior was added in be4ecdcc87984e9421ff5d5c90d33f475e0fbc01. 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.
| * | | | | Fix #6635. We should call Scoping methods, before calling Array methods.kennyj2012-06-101-0/+9
| | | | | |
* | | | | | Ensure that mass assignment options are preservedAndrew White2012-06-101-0/+22
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two possible scenarios where the @mass_assignment_options instance variable can become corrupted: 1. If the assign_attributes doesn't complete correctly, then subsequent calls to a nested attribute assignment method will use whatever options were passed to the previous assign_attributes call. 2. With nested assign_attributes calls, the inner call will overwrite the current options. This will only affect nested attributes as the attribute hash is sanitized before any methods are called. To fix this we save the current options in a local variable and then restore these options in an ensure block.
* | | | | Use . instead of :: for class methods, add CHANGELOG entriesJosé Valim2012-06-101-2/+2
| | | | |
* | | | | Merge pull request #6665 from schneems/schneems/raise-migration-errorJosé Valim2012-06-101-0/+15
|\ \ \ \ \ | | | | | | | | | | | | Notify A User they Have Pending Migrations
| * | | | | raise error for pending migration schneems2012-06-091-2/+2
| | | | | | | | | | | | | | | | | | can be configured by setting config.active_record.migration. Setting to :page_load will raise an error on each page refresh if there are migrations that are pending. Setting to :page_load is defaulted in development for new applications.
| * | | | | add convenience methods for checking migrationsschneems2012-06-031-0/+15
| | | | | | | | | | | | | | | | | | if a rails project needs to be migrated ActiveRecord::Migrator.needs_migration? will be true or false if the current version matches the last version.
* | | | | | Fix fragile #assert_queries implementation and usages.Steve Jorgensen2012-06-094-6/+6
| |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several tests that passed when run in the order they are loaded by rake test were failing when run in different sequences due to problems with the implementation of assert_queries and assert_no_queries as well as incorrect assumptions made about how many queries might be executed by a database adapter in various cases.
* | | | | Skip two tests with polymorphic if current adapter is Oracle Adapter.Yasuo Honda2012-06-081-0/+3
| | | | | | | | | | | | | | | | | | | | because Oracle Adapter does not support foreign keys if :polymorphic => true is used.
* | | | | Merge pull request #6629 from marcandre/destroyCarlos Antonio da Silva2012-06-062-0/+9
|\ \ \ \ \ | | | | | | | | | | | | Add ActiveRecord::Base#destroy!
| * | | | | + ActiveRecord::Base#destroy!Marc-Andre Lafortune2012-06-062-0/+9
| | | | | |
* | | | | | stop `to_s`ing method namesAkira Matsuda2012-06-062-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Module#methods are Symbols in Ruby >= 1.9
* | | | | | Merge pull request #6616 from dpassage/fix_resolver_test_sqlite3Carlos Antonio da Silva2012-06-051-0/+3
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Resolver tests fail if mysql adapter not installed
| * | | | | The resolver tests fail if the mysql gem is not installed; this breaksDavid Paschich2012-06-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | being able to run the sqlite3 tests without that gem. This fix ensures the tests will only run if the mysql gem is installed. A better solution might be to move these tests into the per-adapter tests, and test each adapter's resolver.
* | | | | | Add failing test for 3.2.5 datetime attribute regressionEvan Arnold2012-06-041-0/+11
|/ / / / /
* | | | | a test case that ensures AR::Relation#merge can merge associationsAkira Matsuda2012-06-031-0/+8
| | | | |
* | | | | modulize AR::NullRelationAkira Matsuda2012-06-011-1/+6
| | | | | | | | | | | | | | | | | | | | now we can invoke previously added scope extension methods
* | | | | Merge branch 'master-sec'Aaron Patterson2012-05-311-0/+19
|\ \ \ \ \ | |_|_|/ / |/| | | | | | | | | | | | | | | | | | | * master-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
| * | | | 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
* | | | | Fix backward compatibility with stored Hash values. Wrap coders to convert ↵Jeremy Kemper2012-05-301-13/+16
| |/ / / |/| | | | | | | | | | | serialized values to indifferent access.
* | | | 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
| * | | | Fix #5797. Error calling dup method on AR model with serialized fieldkennyj2012-05-301-0/+9
| | | | |
* | | | | Merge pull request #6386 from kennyj/fix_logs_name_consistencyAaron Patterson2012-05-304-15/+108
|\ \ \ \ \ | |/ / / / |/| | | | Fix logs name consistency.
| * | | | Fix logs name consistency.kennyj2012-05-194-15/+108
| | | | |
* | | | | Add tests to delete by fixnum or string id with has many through associationsFrancesco Rodriguez2012-05-281-0/+20
| | | | |
* | | | | Fix failing build related to change in CollectionAssociation#deleteCarlos Antonio da Silva2012-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | Merge commit 6f1d9d00ffd9d411b2bd488da4eb92b7e2fd972e
* | | | | Allow blocks for count with ActiveRecord::Relation. Document and test that ↵chrisfinne2012-05-281-0/+16
| | | | | | | | | | | | | | | | | | | | sum allows blocks
* | | | | Add support for CollectionAssociation#delete by Fixnum or StringFrancesco Rodriguez2012-05-281-3/+17
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found the next issue between CollectionAssociation `delete` and `destroy`. class Person < ActiveRecord::Base has_many :pets end person.pets.destroy(1) # => OK, returns the destroyed object person.pets.destroy("2") # => OK, returns the destroyed object person.pets.delete(1) # => ActiveRecord::AssociationTypeMismatch person.pets.delete("2") # => ActiveRecord::AssociationTypeMismatch Adding support for deleting with a fixnum or string like `destroy` method.
* | | | ConnectionPool wait_timeout no longer used for different types of timeouts. ↵Jonathan Rochkind2012-05-233-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #6441 An AR ConnectionSpec `wait_timeout` is pre-patch used for three different things: * mysql2 uses it for MySQL's own wait_timeout (how long MySQL should allow an idle connection before closing it), and defaults to 2592000 seconds. * ConnectionPool uses it for "number of seconds to block and wait for a connection before giving up and raising a timeout error", default 5 seconds. * ConnectionPool uses it for the Reaper, for deciding if a 'dead' connection can be reaped. Default 5 seconds. Previously, if you want to change these from defaults, you need to change them all together. This is problematic _especially_ for the mysql2/ConnectionPool conflict, you will generally _not_ want them to be the same, as evidenced by their wildly different defaults. This has caused real problems for people #6441 #2894 But as long as we're changing this, forcing renaming the ConnectionPool key to be more specific, it made sense to seperate the two ConnectionPool uses too -- these two types of ConnectionPool timeouts ought to be able to be changed independently, you won't neccesarily want them to be the same, even though the defaults are (currently) the same.
* | | | changed xml type datetime to dateTime, fixes #6328Angelo capilleri2012-05-231-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | XmlMini define the xml 'datatime', but according to http://www.w3.org/TR/xmlschema-2/#dateTime could be better change this to 'dateTime' with upper case letter 'T. So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime' add the changing to the changelog
* | | | Revert "Merge pull request #6416 from pmahoney/threadsafe-connection-pool"Rafael Mendonça França2012-05-222-116/+1
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit d2901f0fc4270a765717ad572d559dc49a56b3a8, reversing changes made to 525839fdd8cc34d6d524f204528d5b6f36fe410c. Conflicts: activerecord/test/cases/connection_pool_test.rb Reason: This change broke the build (http://travis-ci.org/#!/rails/rails/builds/1391490) and we don't have any solution until now. I asked the author to try to fix it and open a new pull request.
* | | Merge pull request #6368 from Antiarchitect/store-indifferent-accessJeremy Kemper2012-05-221-0/+34
|\ \ \ | | | | | | | | Support migrating from Hash to HashWithIndifferentAccess for accessing attributes.
| * | | Convert Hash to HashWithIndifferentAccess in ActiveRecord::Store.Andrey Voronkov2012-05-221-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to make migration from 3.x apps easier, we should try to convert Hash instances to HashWithIndifferentAccess, to allow accessing values with both symbol and a string. This is follow up to changes in 3c0bf043.
* | | | Restore the frozen state on rollback. Fixes #6417.Godfrey Chan2012-05-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Remove not used variables from connection poll testCarlos Antonio da Silva2012-05-211-2/+2
| | | | | | | | | | | | | | | | These variables were issuing some "not used" warnings.