aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
* Fix typoRafael Mendonça França2014-07-041-1/+1
|
* Merge pull request #16028 from ↵Rafael Mendonça França2014-07-041-0/+10
|\ | | | | | | | | | | | | | | | | cade/fix_counter_cache_count_with_association_selects Add `:all` argument to `count` in `reset_counters` Conflicts: activerecord/CHANGELOG.md
| * Add `:all` argument to `count` in `reset_counters`Cade Truitt2014-07-021-0/+10
| | | | | | | | | | | | | | | | | | | | Prior to this fix, if an association had a scope with a `select`, calls to `reset_counters` would generate invalid SQL and throw: ActiveRecord::StatementInvalid: [$DB_ADAPTER]: wrong number of arguments to function COUNT() References #10710, #13648
* | Merge pull request #16049 from matthewd/find-via-reloadMatthew Draper2014-07-051-0/+12
|\ \ | | | | | | After find-via-reload, the record is not new
| * | After find-via-reload, the record is not newMatthew Draper2014-07-051-0/+12
| | |
* | | Merge pull request #16037 from sgrif/sg-money-quotingRafael Mendonça França2014-07-041-0/+24
|\ \ \ | |/ / |/| | Remove unneccessary special case for money in quoting
| * | Remove unneccessary special case for money in quotingSean Griffin2014-07-031-0/+24
| |/
* | Merge pull request #16036 from sgrif/sg-datetime-infinityRafael Mendonça França2014-07-031-0/+44
|\ \ | | | | | | Do not rely on the column type when quoting infinity
| * | Do not rely on the column type when quoting infinitySean Griffin2014-07-031-0/+44
| |/
* / Use the type object for type casting HStore columnsSean Griffin2014-07-031-11/+5
|/
* Quote range strings when quoting PG rangesSean Griffin2014-07-022-1/+18
| | | | | The test case for CVE-2014-3483 doesn't actually send the generated SQL to the database. The generated SQL is actually invalid for real inputs.
* Fix SQL injection when querying against ranges and bitstringsRafael Mendonça França2014-07-021-0/+11
| | | | Fix CVE-2014-3483 and protect against CVE-2014-3482.
* Don't error when `dup`ing a record with no PKSean Griffin2014-07-021-0/+12
|
* do not hold on to a stale connection object. fixes #15998Aaron Patterson2014-07-011-2/+5
|
* Add regression tests for keys on nested associationseileencodes2014-07-011-0/+32
| | | | | | This adds the regressions tests from issue #15893 to master. It's checking that both strings and symbols are accepted as keys for nested associations.
* Use the type object for sending JSON to the databaseSean Griffin2014-06-291-1/+1
|
* Always pass a column with a type object to quoteSean Griffin2014-06-282-13/+2
| | | | | | | | The only case where we got a column that was not `nil`, but did not respond to `cast_type` was when type casting the default value during schema creation. We can look up the cast type, and add that object to the column definition. Will allow us to consistently rely on the type objects for type casting in all directions.
* [Postgresql tests] remove duplicate helperAbdelkader Boudih2014-06-281-12/+3
|
* Merge pull request #15934 from seuros/renameRafael Mendonça França2014-06-271-0/+10
|\ | | | | | | rename primary key sequence only if it exists
| * rename sequence only if it existsAbdelkader Boudih2014-06-271-0/+10
| |
* | Do not change the global state of the test suiteRafael Mendonça França2014-06-271-18/+1
| |
* | Improve tests to use add_foreign_key DSLRafael Mendonça França2014-06-271-18/+11
| |
* | MySQL doesn't works with foreign keyRafael Mendonça França2014-06-271-3/+2
|/
* Merge pull request #12450 from iantropov/masterRafael Mendonça França2014-06-271-0/+36
|\ | | | | | | | | | | | | | | | | Fix bug, when ':dependent => :destroy' violates foreign key constraints Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/associations/builder/association.rb activerecord/lib/active_record/associations/builder/has_one.rb
| * Fix bug, when ':dependent => :destroy' option violates foreign key ↵Ivan Antropov2013-10-261-0/+36
| | | | | | | | constraints, issue #12380
* | Merge pull request #15788 from sgrif/sg-mutable-stringsRafael Mendonça França2014-06-273-12/+39
|\ \ | | | | | | | | | Detect in-place modifications on Strings
| * | Detect in-place modifications on StringsSean Griffin2014-06-173-12/+39
| | |
* | | Merge pull request #8639 from bogdan/valid-with-bangRafael Mendonça França2014-06-271-0/+14
|\ \ \ | | | | | | | | | | | | Add AR::Base#valid! method
| * | | Add AR::Base#validate! methodBogdan Gusiev2014-06-231-0/+14
| | | | | | | | | | | | | | | | | | | | Acts same as valid? but raises AR::RecordInvalid exception if validation fails
* | | | fk: use random digest namesYves Senn2014-06-261-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | The name of the foreign key is not relevant from a users perspective. Using random names resolves the urge to rename the foreign key when the respective table or column is renamed.
* | | | fk: raise for invalid :on_update / :on_delete valuesYves Senn2014-06-261-0/+10
| | | |
* | | | fk: `add/remove_foreign_key` are noop for adapters that don't support fkYves Senn2014-06-261-0/+24
| | | |
* | | | fk: dump foreign keys at the bottom to make sure tables exist.Yves Senn2014-06-261-0/+7
| | | |
* | | | fk: raise when identifiers are longer than `allowed_index_name_length`.Yves Senn2014-06-261-0/+9
| | | |
* | | | fk: support for on_updateYves Senn2014-06-261-3/+13
| | | |
* | | | fk: rename `dependent` to `on_delete`Yves Senn2014-06-261-13/+13
| | | |
* | | | fk: infere column name from table names.Yves Senn2014-06-262-2/+29
| | | | | | | | | | | | | | | | This allows to create and remove foreign keys without specifying a column.
* | | | fk: make `add_foreign_key` reversible.Yves Senn2014-06-262-0/+39
| | | |
* | | | fk: support dependent option (:delete, :nullify and :restrict).Yves Senn2014-06-261-0/+42
| | | |
* | | | fk: dump foreign keys to schema.rbYves Senn2014-06-262-1/+18
| | | | | | | | | | | | | | | | respect `table_name_prefix` and `table_name_suffix`.
* | | | fk: `:primary_key` option for non-standard pk's.Yves Senn2014-06-261-0/+20
| | | |
* | | | fk: generalize using `AlterTable` and `SchemaCreation`.Yves Senn2014-06-261-2/+4
| | | |
* | | | fk: `foreign_keys`, `add_foreign_key` and `remove_foreign_key` for MySQLYves Senn2014-06-261-0/+5
| | | |
* | | | fk: add `foreign_keys` for PostgreSQL adapter.Yves Senn2014-06-261-7/+27
| | | |
* | | | fk: `add_foreign_key` and `remove_foreign_key` for PostgreSQL adapter.Yves Senn2014-06-261-0/+49
| | | |
* | | | Merge pull request #15924 from sgrif/sg-write-unknown-columnRafael Mendonça França2014-06-262-2/+19
|\ \ \ \ | | | | | | | | | | Move writing unknown column exception to null attribute
| * | | | Move writing unknown column exception to null attributeSean Griffin2014-06-262-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making this change revealed several subtle bugs related to models with no primary key, and anonymous classes. These have been fixed as well, with regression tests added.
* | | | | Merge pull request #15916 from sgrif/sg-test-update-allRafael Mendonça França2014-06-264-30/+28
|\ \ \ \ \ | |/ / / / |/| | | | Consolidate testing of update_all type casting
| * | | | Consolidate testing of update_all type castingSean Griffin2014-06-264-30/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have several test cases on "tricky" types that are essentially testing that `update_all` goes through the same type casting behavior as a normal assignment + save. We recently had another case to add this test for another type in https://github.com/rails/rails/pull/12742. Rather than testing this separately for every type which is "tricky" when round tripping, let's instead have a fairly exhaustive test that ensures we're getting the correct values at every step for `update_all`. Given the structure of the code now, we can be confident that if the type is correct, and `update_all` is type casting correctly, we're going to get the right behavior for all types.
* | | | | Deprecate automatic counter caches on has_many :throughSean Griffin2014-06-268-29/+56
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reliant on https://github.com/rails/rails/pull/15747 but pulled to a separate PR to reduce noise. `has_many :through` associations have the undocumented behavior of automatically detecting counter caches. However, the way in which it does so is inconsistent with counter caches everywhere else, and doesn't actually work consistently. As with normal `has_many` associations, the user should specify the counter cache on the `belongs_to`, if they'd like it updated.