aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | Deprecate `reset_#{attribute}` in favor of `restore_#{attribute}`.Rafael Mendonça França2014-07-151-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods may cause confusion with the `reset_changes` that behaves differently of them. Also rename undo_changes to restore_changes to match this new set of methods.
* | | | | | | | | Keep quietly and capture undeprecated on your suiteRafael Mendonça França2014-07-152-0/+29
| | | | | | | | |
* | | | | | | | | Document the change in `nil` handling for serialized attributesGodfrey Chan2014-07-151-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also updated the test case to reflect that
* | | | | | | | | Fixed SQL syntax for postgresqlGodfrey Chan2014-07-151-1/+1
| | | | | | | | |
* | | | | | | | | Merge pull request #16162 from chancancode/fix_json_coderGodfrey Chan2014-07-151-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed JSON coder when loading NULL from DB
* | | | | | | | | Revert "Revert "Merge pull request #16059 from jenncoop/json-serialized-attr""Godfrey Chan2014-07-151-1/+15
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f. Conflicts: activerecord/CHANGELOG.md
* | | | | | | | Merge pull request #15266 from dv/use_counter_cache_for_empty_callGodfrey Chan2014-07-151-0/+7
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | If a counter_cache exists, use it for #empty?
| * | | | | | | If a counter_cache exists, use it for #empty?David Verhasselt2014-06-101-0/+7
| | | | | | | |
* | | | | | | | Merge pull request #16089 from ↵Aaron Patterson2014-07-141-34/+30
|\ \ \ \ \ \ \ \ | |_|_|_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | eileencodes/refactor-reflections-from-sub-classes-to-delegates Refactor reflections from sub classes to delegates
| * | | | | | | Begin refactoring ThroughReflectioneileencodes2014-07-081-34/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to decouple AssociationReflection and ThroughReflection making ThroughReflection it's own Reflection bucket in a way. The benefit of this is to be able to remove checks against the macro's symbol for exmaple `macro == :belongs_to`. Get all tests passing again Some of the methods that used to be inherited from MacroReflection through AssociationReflection were no longer getting passed through. They needed to be duplicated into the ThroughReflection. I will extract these out into a separate class. Refactor shared methods into strategy object Now that we've separated ThroughReflection and AssociationReflection we can combine shared methods into one class to avoid duplication. Break out class for each type of reflection This creates a class for each reflection type (has_many, has_one, belongs_to and habtm). We then can remove the need to set the macro symbol in each initialization. Tests were updated to reflect these changes because creation of these reflections is now different. Remove need for @collection instance var We now define `collection?` as `false` by default and set it to `true` in `has_and_belongs_to_many` and `has_many` reflections. This removes the need for the `@collection` instance variable. Raise exception on unknown macro types We shouldn't accept just any macro when creating reflections. An unrecongnized AssociationReflection raises an error. Tests in `reflection_test` were updated to reflect these new changes. `:has_and_belongs_to_many` macro tests were removed because we no longer internally return HABTM.
* | | | | | | | Address ORA-00972: identifier is too long when tested with OracleYasuo Honda2014-07-143-4/+5
| |_|_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | by using shorter attribute names.
* | | | | | | Merge pull request #16127 from Envek/fix_16111Matthew Draper2014-07-141-0/+23
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Dump PostgreSQL primary key with custom function as a default.
| * | | | | | | Dump PostgreSQL primary key with custom function as a default.Andrey Novikov2014-07-111-0/+23
| | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, if use pgcrypto extension in PostgreSQL 9.4 beta 1, where uuid-ossp extension isn't available for moment of writing, and thus to use a gen_random_uuid() method as a primary key default. In this case schema dumper wasn't able to correctly reconstruct create_table statement and lost primary key constraint on schema load. Fixes #16111.
* | | | | | | Merge pull request #16055 from sgrif/sg-refactor-sqlite3-stringsMatthew Draper2014-07-121-0/+7
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Use a type object for type casting behavior on SQLite3
| * | | | | | Use a type object for type casting behavior on SQLite3Sean Griffin2014-07-111-0/+7
| | | | | | |
* | | | | | | Include fixtures to prevent foreign key violation.Zuhao Wan2014-07-091-0/+2
| | | | | | |
* | | | | | | Merge pull request #16093 from ↵Rafael Mendonça França2014-07-081-0/+1
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | zuhao/refactor_activerecord_nested_through_associations_test Warm up cache to prevent assertion failure.
| * | | | | | Warm up cache to prevent assertion failure.Zuhao Wan2014-07-081-0/+1
| | | | | | |
* | | | | | | Merge pull request #16072 from sgrif/sg-xml-quotingRafael Mendonça França2014-07-081-1/+14
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | Don't rely on the sql type to quote XML columns in PG
| * | | | | | Don't rely on the sql type to quote XML columns in PGSean Griffin2014-07-061-1/+14
| |/ / / / /
* / / / / / Remove the `text?` predicate from the type objectsSean Griffin2014-07-0614-18/+0
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was only used for uniqueness validations. The first usage was in conjunction with `limit`. Types which cast to string, but are not considered text cannot have a limit. The second case was only with an explicit `:case_sensitive => true` option given by the user.
* | | | | Change back occurrences of SQLite(3) to sqlite3 when referring to theZachary Scott2014-07-061-5/+6
| | | | | | | | | | | | | | | | | | | | adapter, fixed from #16057 [ci skip]
* | | | | Merge pull request #16057 from akshay-vishnoi/doc_changeZachary Scott2014-07-061-2/+2
|\ \ \ \ \ | | | | | | | | | | | | [ci skip] /sqlite/i --> SQLite
| * | | | | [ci skip] /sqlite/i --> SQLiteAkshay Vishnoi2014-07-061-2/+2
| | | | | |
* | | | | | active_record: Type cast booleans and durations for string columns.Dylan Thacker-Smith2014-07-062-3/+34
| | | | | |
* | | | | | Revert "Merge pull request #16059 from jenncoop/json-serialized-attr"Godfrey Chan2014-07-051-15/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a03097759bd7103bb9db253e7ba095f011453f75. This needs more work before it would work correctly on master.
* | | | | | Merge pull request #16059 from jenncoop/json-serialized-attrGodfrey Chan2014-07-051-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed issue with ActiveRecord serialize object as JSON Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods/serialization.rb
* | | | | | Fix mysql/mysql2 failing with FK constraint errorsGodfrey Chan2014-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the author fixture we have ("david") references an author address by ID. Since we disable FK checks when inserting fixtures, this is all fine until we try to update it, at which point MySQL would complain about the missing row referenced by the `author_address_id`. [Godfrey Chan, Matthew Draper]
* | | | | | Re-enable foriegn key tests on MySQLGodfrey Chan2014-07-052-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e84799d, e31104c and e6ca8e2
* | | | | | Use the type object for quoting PG RangesSean Griffin2014-07-052-6/+6
| | | | | |
* | | | | | Add a `required` option to singular associationsSean Griffin2014-07-041-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition to defining the association, a `required` association will also have its presence validated. Before: ```ruby belongs_to :account validates_presence_of :account ``` After: ```ruby belongs_to :account, required: true ``` This helps to draw a distinction between types of validations, since validations on associations are generally for data integrity purposes, and aren't usually set through form inputs.
* | | | | | 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
| | | |
* | | | MySQL doesn't work with foreign keysPhilippe Creux2014-06-271-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | This was previously fixed in e84799d but broken in 3f596f8. This commit reintroduced the conditional that prevents the foreign keys from being added to MySQL databases.