aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
* test case to prevent duplicated associations with custom PK.Yves Senn2013-02-241-0/+10
| | | | closes #9201
* Oracle enhanced adapter shortens its name if it is longer than 30 bytesYasuo Honda2013-02-241-2/+10
| | | | because of Oracle database index length spec.
* also rename the test-case class inside columns_test.rbYves Senn2013-02-241-1/+1
|
* rename_column_test.rb -> columns_test.rb to reveal intent.Yves Senn2013-02-231-0/+0
| | | | | | | | I renamed the test to better communicate it's intention. Since it also tests: - add_column - remove_column - change_column There is no reason to call it rename_column_test.
* forwardport #9388 rename/remove column preserves custom PK.Yves Senn2013-02-231-1/+15
|
* Fix warningRafael Mendonça França2013-02-211-1/+1
|
* Skip failing test and add a FIXME noteRafael Mendonça França2013-02-201-0/+2
|
* also rename indexes when a table or column is renamedYves Senn2013-02-202-3/+34
| | | | When a table or a column is renamed related indexes kept their name. This will lead to confusing names. This patch renames related indexes when a column or a table is renamed. Only indexes with names generated by rails will be renamed. Indexes with custom names will not be renamed.
* reserve index name chars for internal rails operationsYves Senn2013-02-202-5/+34
| | | | | | | | | | | Some adapter (SQLite3) need to perform renaming operations to support the rails DDL. These rename prefixes operate with prefixes. When an index name already uses up the full space provieded by `index_name_length` these internal operations will fail. This patch introduces `allowed_index_name_length` which respects the amount of characters used for internal operations. It will always be <= `index_name_length` and every adapter can define how many characters need to be reserved.
* Merge pull request #9332 from ↵Rafael Mendonça França2013-02-201-0/+16
|\ | | | | | | | | wangjohn/adding_documentation_to_error_raising_in_query_methods Tests to make sure empty arguments in WhereChain raise errors
| * Added comments about the check_empty_arguments method which is calledwangjohn2013-02-201-0/+16
| | | | | | | | | | for query methods in a where_clause. Also, modified the CHANGELOG entry because it had false information and added tests.
* | Reduced memory leak problem in transactions by lazily updating AR objects ↵wangjohn2013-02-201-2/+2
|/ | | | with new transaction state. If AR object has a callback, the callback will be performed immediately (non-lazily) so the transaction still has to keep records with callbacks.
* Whitespace :heart: and hash syntax changeRafael Mendonça França2013-02-201-23/+22
|
* descriptive error message when AR adapter was not found. Closes #7313.Yves Senn2013-02-201-0/+9
|
* delete duplicated tests in AR base_test.rbTakehiro Adachi2013-02-191-23/+0
| | | | These are duplicated with the tests which are in relations_test.rb
* add tests for ActiveRecord::Base#createTakehiro Adachi2013-02-181-0/+8
|
* Revert "checking in the abstractions for valid type checking:"Jon Leighton2013-02-153-27/+0
| | | | | | | | | | | | | | | | This reverts commit c321b309a9a90bbfa0912832c11b3fef52e71840. Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb Reason: failing test 1) Error: test_valid_column(ActiveRecord::ConnectionAdapters::SQLite3AdapterTest): NoMethodError: undefined method `column' for test/cases/adapters/sqlite3/sqlite3_adapter_test.rb:29:in `test_valid_column'
* don't cache invalid subsets when preloading hmt associations.Yves Senn2013-02-141-0/+6
| | | | closes #8423.
* Don't call after_commit when creating through an association and save fails, ↵James Miller2013-02-131-0/+27
| | | | fixes #5802
* Merge pull request #9204 from ranjaykrishna/col-probAaron Patterson2013-02-123-0/+27
|\ | | | | schema dumper tests now conducted by ActiveRecord::Base.Connection
| * checking in the abstractions for valid type checking:Ranjay Krishna2013-02-123-0/+27
| |
* | test for regression from a712e08ebe21f6d8653a0e6602df2e0f5d40d9caAaron Patterson2013-02-111-0/+6
| |
* | define Active Record Store accessors in a moduleSergey Nartimov2013-02-111-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Allow store accessors to be overrided like other attribute methods, e.g.: class User < ActiveRecord::Base store :settings, accessors: [ :color, :homepage ], coder: JSON def color super || 'red' end end
* | fixing bit string testAaron Patterson2013-02-101-3/+3
| |
* | Reverting e170014113 (Change behaviour with empty hash in where clause)Guillermo Iguaran2013-02-081-6/+2
| |
* | Reverting 16f6f25 (Change behaviour with empty array in where clause)Guillermo Iguaran2013-02-083-6/+12
| |
* | Change behaviour with empty array in where clauserobertomiranda2013-02-083-12/+6
| |
* | Change behaviour with empty hash in where clauserobertomiranda2013-02-081-2/+6
| |
* | Merge pull request #9207 from dylanahsmith/mysql-quote-numericGuillermo Iguaran2013-02-073-10/+35
|\ \ | | | | | | active_record: Quote numeric values compared to string columns.
| * | active_record: Quote numeric values compared to string columns.Dylan Smith2013-02-073-10/+35
| | |
* | | Skip schema dumper extensions test if connection does not support itCarlos Antonio da Silva2013-02-071-0/+1
|/ / | | | | | | | | Travis failed because the postgresql version installed there does not support extensions, so we just need to skip this for now.
* | Run schema dumper extensions without creating real extensionsCarlos Antonio da Silva2013-02-061-9/+2
| | | | | | | | | | There is no need to create the extension in the database just to test if it's dumped, we can stub that instead.
* | Do not print anything related to extensions when they don't none existCarlos Antonio da Silva2013-02-061-0/+10
| | | | | | | | | | When extensions are supported but there's no one enabled in the database, we should not print anything related to them in schema.rb.
* | improve tests to check for existence of extensions method, and skip testing ↵Justin George2013-02-062-8/+8
| | | | | | | | dumped extensions if they are unsupported by the database
* | Add some tests to enumerate how extensions should be stored in the schema outputJustin George2013-02-062-0/+15
| |
* | Enable hstore extensions on tests if it is not enabled and database supports itRafael Mendonça França2013-02-051-1/+8
| |
* | DATABASE_URL parsing should turn numeric strings into numeric types, andAaron Stone2013-01-311-11/+37
| | | | | | | | | | | | the strings true and false into boolean types, in order to match how YAML would parse the same values from database.yml and prevent unexpected type errors in the database adapters.
* | Merge pull request #9119 from dazuma/database_tasks_for_unknown_adapterCarlos Antonio da Silva2013-01-311-0/+6
|\ \ | | | | | | Raise an exception with a useful message if a rake task is requested for an unknown adapter
| * | Raise a specific exception with a useful message if a rake task is requested ↵Daniel Azuma2013-01-301-0/+6
| | | | | | | | | | | | for an unknown adapter
* | | class_eval should use __FILE__ and __LINE__Neeraj Singh2013-01-301-1/+1
|/ /
* | add API to pg for enabling / disabling hstoreAaron Patterson2013-01-281-7/+29
| |
* | Use Encoding::UTF_8 constant :do_not_litter:Akira Matsuda2013-01-282-2/+2
| |
* | Prevent Relation#merge from collapsing wheres on the RHSJon Leighton2013-01-272-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This caused a bug with the new associations implementation, because now association conditions are represented as Arel nodes internally right up to when the whole thing gets turned to SQL. In Rails 3.2, association conditions get turned to raw SQL early on, which prevents Relation#merge from interfering. The current implementation was buggy when a default_scope existed on the target model, since we would basically end up doing: default_scope.merge(association_scope) If default_scope contained a where(foo: 'a') and association_scope contained a where(foo: 'b').where(foo: 'c') then the merger would see that the same column is representated on both sides of the merge and collapse the wheres to all but the last: where(foo: 'c') Now, the RHS of the merge is left alone. Fixes #8990
* | Fix cases where delete_records on a has_many association caused errorsDerek Kraan2013-01-271-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | because of an ambiguous column name. This happened if the association model had a default scope that referenced a third table, and the third table also referenced the original table (with an identical foreign_key). Mysql requires that ambiguous columns are deambiguated by using the full table.column syntax. Postgresql and Sqlite use a different syntax for updates altogether (and don't tolerate table.name syntax), so the fix requires always including the full table.column and discarding it later for Sqlite and Postgresql.
* | Fix handling of dirty time zone aware attributesLilibeth De La Cruz2013-01-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when `time_zone_aware_attributes` were enabled, after changing a datetime or timestamp attribute and then changing it back to the original value, `changed_attributes` still tracked the attribute as changed. This caused `[attribute]_changed?` and `changed?` methods to return true incorrectly. Example: in_time_zone 'Paris' do order = Order.new original_time = Time.local(2012, 10, 10) order.shipped_at = original_time order.save order.changed? # => false # changing value order.shipped_at = Time.local(2013, 1, 1) order.changed? # => true # reverting to original value order.shipped_at = original_time order.changed? # => false, used to return true end
* | `#count` in conjunction with `#uniq` performs distinct count.Yves Senn2013-01-261-0/+4
| | | | | | | | closes #6865
* | Remove obsolete test fileJon Leighton2013-01-251-35/+0
| | | | | | | | https://github.com/rails/rails/commit/4beb4dececcf10c642c74fbcb8548c833e921a86#commitcomment-2482869
* | reduce the number of queries on IN clauses, fix relation queries in `where`Aaron Patterson2013-01-241-1/+14
| |
* | Set Thread.abort_on_exception for the whole AS, AP, and AR testsAkira Matsuda + Koichi Sasada2013-01-241-0/+2
| | | | | | | | this would give us some more clues in case a test silently dies inside Thread
* | Fix PostgreSQL tests on TravisAndrew White2013-01-241-10/+31
| | | | | | | | Travis only has PostgreSQL 9.1.x but 9.2 is required for range datatypes.