aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix behavior of handling BC era dates.edogawaconan2014-06-051-0/+12
| | | | BC era year is (astronomical year + 1) and starts from 1 BC.
* Merge pull request #15512 from akshay-vishnoi/delete-deprecated-methodYves Senn2014-06-051-41/+0
|\ | | | | | | Remove deprecated method ActiveRecord::Migrator.proper_table_name
| * Remove deprecated method ActiveRecord::Migrator.proper_table_nameAkshay Vishnoi2014-06-051-41/+0
| |
* | Fix inverse associations testLeandro Facchinetti2014-06-041-1/+1
|/ | | | | | `InverseHasManyTests#test_parent_instance_should_be_shared_within_create_block_of_new_child` was mistakenly the same as `InverseHasManyTests#test_parent_instance_should_be_shared_within_build_block_of_new_child`.
* have an actual `NullColumn` object and update docs accordingly.Yves Senn2014-06-041-0/+1
| | | | | | Follow up to #15438 and #15502. /cc @sgrif
* Merge pull request #15504 from sgrif/sg-postgres-defaultsRafael Mendonça França2014-06-041-0/+5
|\ | | | | Collapse PG default extractoin of most types to single regex
| * Collapse PG default extractoin of most types to single regexSean Griffin2014-06-041-0/+5
| | | | | | | | | | | | | | For any type that is represented as a string and then type cast, we do not need separate regular expressions for the various types. No function will match this regex. User defined types *should* match this, so that the type object can decide what to do with the value.
* | Merge pull request #15463 from geopet/refactor_xml_compute_typeRafael Mendonça França2014-06-041-2/+3
|\ \ | |/ |/| Refactor XML serializer to not depend on `serialized_attributes`
| * Test the serialized types of virtual columns in XMLGeoff Petrie & Sean Griffin2014-06-011-2/+3
| | | | | | | | | | | | | | The previous tests were passing, because nothing ever looked at the generated XML. What was previously being generated was `<firstname type="NilClass">...`, which is not consistent with all other cases where there is not a known type.
* | Merge pull request #15482 from laurocaetano/fix-regression-for-eager-loadCarlos Antonio da Silva2014-06-042-0/+16
|\ \ | | | | | | | | | | | | | | | | | | Fix regression on eager loading association based on SQL query rather than existing column. Conflicts: activerecord/CHANGELOG.md
| * | Fix regression on eager loading association based on SQL query ratherLauro Caetano2014-06-032-0/+16
| | | | | | | | | | | | | | | | | | than existing column. Fixes #15480.
* | | Merge pull request #15438 from sgrif/sg-null-columnRafael Mendonça França2014-06-031-0/+19
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Return a null column when no column exists for an attribute Conflicts: activerecord/CHANGELOG.md
| * | | Return a null column when no column exists for an attributeSean Griffin2014-06-031-0/+19
| | | |
* | | | Merge pull request #15172 from notEthan/active_record_pretty_printRafael Mendonça França2014-06-031-0/+68
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implement ActiveRecord::Base#pretty_print Conflicts: activerecord/CHANGELOG.md
| * | | | implement ActiveRecord::Base#pretty_print + changelogEthan2014-05-291-0/+68
| | | | |
* | | | | Merge pull request #15492 from sgrif/sg-dirty-defaultsRafael Mendonça França2014-06-031-0/+28
|\ \ \ \ \ | | | | | | | | | | | | Keep column defaults in type cast form
| * | | | | Keep column defaults in type cast formSean Griffin2014-06-031-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The contract of `_field_changed?` assumes that the old value is always type cast. That is not the case for the value in `Column#default` as things are today. It appears there are other public methods that assume that `Column#default` is type cast, as well. The reason for this change originally was because the value gets put into `@raw_attributes` in initialize. This reverts to the old behavior on `Column`, and updates `initialize` to make sure that the values are in the right format.
* | | | | | force table creationAaron Patterson2014-06-031-2/+3
| | | | | |
* | | | | | Revert "test pg, we don't care about the internal state of `column#default`."Yves Senn2014-06-037-0/+23
| |_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "test pg, remove unused column assignments. Follow up to 254cdf47" Related to #15492 This reverts commit 254cdf4728291277f3fbaa854f34495030e476b4. This reverts commit 4bcf9029452e0c760af04faab6b549710401e8cf. There are public methods that assume `Column#default` is type casted. The return value of `Column#default` is publicly relevant and should not change. /cc @sgrif
* | | | | test pg, remove unused column assignments. Follow up to 254cdf47Yves Senn2014-06-035-12/+0
| | | | |
* | | | | pg, preserve money type when dumping schema and extract money default.Yves Senn2014-06-033-17/+26
| | | | |
* | | | | test pg, rm unused requires.Yves Senn2014-06-0311-27/+0
| |_|/ / |/| | |
* | | | Respect limit for PG bit stringsSean Griffin2014-06-031-8/+8
| | | |
* | | | pg, preserve type when schema dumping bit and bit varying columns.Yves Senn2014-06-031-8/+8
| | | |
* | | | test pg, move bit string type tests into `bit_string_test.rb`.Yves Senn2014-06-033-42/+80
| | | |
* | | | test pg, we don't care about the internal state of `column#default`.Yves Senn2014-06-035-9/+0
|/ / / | | | | | | | | | | | | That data is internal to Active Record. What we care about is that new records have the right default value.
* | | pg, preserve point type when schema dumping.Yves Senn2014-06-032-9/+9
| | |
* | | pg test, examples for default values and schema dumping of point types.Yves Senn2014-06-032-0/+32
| | | | | | | | | | | | /cc @sgrif
* | | just use `assert`Aaron Patterson2014-06-021-1/+1
| | |
* | | test pg, add basic test cases for point datatype.Yves Senn2014-06-021-0/+45
| | |
* | | New records should remain new after yaml serializationSean Griffin2014-06-011-0/+17
| | |
* | | Remove most code related to serialized propertiesSean Griffin2014-06-013-5/+9
| |/ |/| | | | | | | | | | | | | | | | | | | Nearly completely implemented in terms of custom properties. `_before_type_cast` now stores the raw serialized string consistently, which removes the need to keep track of "state". The following is now consistently true: - `model.serialized == model.reload.serialized` - A model can be dumped and loaded infinitely without changing - A model can be saved and reloaded infinitely without changing
* | Don't change values in `@raw_attributes` during serializationSean Griffin2014-06-012-21/+12
| | | | | | | | | | | | During `init_with`, the attributes given to the coder will be placed into `@raw_attributes`. As such, we should read from `@raw_attributes` when encoding, rather than `@attributes`, which has been type cast.
* | Merge pull request #15434 from sgrif/sg-clear-cachesYves Senn2014-05-311-0/+20
|\ \ | | | | | | Clear all caches calculated based on `@columns` when `@columns` changes
| * | Clear all caches calculated based on `@columns` when `@columns` changesSean Griffin2014-05-311-0/+20
| | |
* | | Add missing test case for writing unknown attributesSean Griffin2014-05-301-0/+2
|/ /
* | Update some bad test cases for serialized columnsSean Griffin2014-05-301-53/+17
| | | | | | | | | | | | | | | | | | | | | | | | The first case was not testing what the issue mentioned actually was (A subclass of a class with serialized attributes does not serialize when they come from the database). The second case was a bad coder. It would fail if the model was `dup`ed, or if the the model was loaded from the database and then saved again. The third case wasn't testing anything that wasn't covered by the second (and was also a bad coder for the same reasons as the second).
* | Merge pull request #15427 from sgrif/sg-rename-attribute-ivarsRafael Mendonça França2014-05-301-1/+1
|\ \ | | | | | | Rename attribute related instance variables to better express intent
| * | Rename attribute related instance variables to better express intentSean Griffin2014-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | `@attributes` was actually used for `_before_type_cast` and friends, while `@attributes_cache` is the type cast version (and caching is the wrong word there, but I'm working on removing the conditionals around that). I opted for `@raw_attributes`, because `_before_type_cast` is also semantically misleading. The values in said hash are in the state given by the form builder or database, so raw seemed to be a good word.
* | | Allow specifying a default value in overloaded propertiesSean Griffin2014-05-302-4/+6
|/ /
* | pg, support default values for enum types. Closes #7814.Yves Senn2014-05-301-0/+11
| | | | | | | | | | This is an intermediate solution. It is related to the refactoring @sgrif is making and will change in the future.
* | pg, `default_sequence_name` respects schema. Closes #7516.Yves Senn2014-05-301-8/+6
| |
* | Merge pull request #11896 from nkondratyev/fix_pg_columns_for_distinctYves Senn2014-05-301-0/+11
|\ \ | | | | | | | | | | | | | | | | | | Fixed #columns_for_distinct of postgresql adapter Conflicts: activerecord/CHANGELOG.md
| * | Fixed `columns_for_distinct` of postgresql adapterNikolay Kondratyev2013-08-151-0/+11
| | |
* | | pg, `reset_pk_sequence!` respects schemas. Closes #14719.Yves Senn2014-05-303-6/+17
| | |
* | | pg, `PostgreSQL::Name` to hold schema qualified names.Yves Senn2014-05-301-2/+43
| | |
* | | Move `type_cast_for_write` behavior over to the serialized type objectSean Griffin2014-05-291-29/+0
| | |
* | | Refactor serialized types to be partially defined as custom propertiesSean Griffin2014-05-292-12/+2
| | | | | | | | | | | | | | | | | | | | | Many of the methods defined in `AttributeMethods::Serialization` can be refactored onto this type as well, but this is a reasonable small step. Removes the `Type` class, and the need for `decorate_columns` to handle serialized types.
* | | Result sets never override a model's column typeSean Griffin2014-05-292-0/+50
| |/ |/| | | | | | | | | | | | | | | | | | | | | MySQL and PostgreSQL provide a column type override in order to properly type cast computed columns included in a result set. This should never override the known types of full fledged columns. In addition to messing up computed properties, this would have led to inconsistent behavior between a record created with `new`, and a record created with `last` on the mysql adapter in the following cases: - `tinyint(1)` with `emulate_booleans` set to `false` - `text`, `string`, `binary`, and `decimal` columns
* | Maintain column order when overriding existing columnsSean Griffin2014-05-281-0/+5
| | | | | | | | | | | | Working towards re-implementing serialized attributes to use the properties API exposed the need for this, as serializing a column shouldn't change the order of the columns.