aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #15865 from sgrif/sg-missing-testYves Senn2014-06-221-0/+20
|\ \ \ | | | | | | | | Add missing test cases for `attribute_names` instance method
| * | | Add missing test cases for `attribute_names` instance methodSean Griffin2014-06-221-0/+20
| |/ / | | | | | | | | | | | | There is a class method with the same name that is tested, but not the instance method.
* / / `reload` should fully reload attributesSean Griffin2014-06-223-5/+8
|/ / | | | | | | | | | | `reload` is meant to put a record in the same state it would be if you were to do `Post.find(post.id)`. This means we should fully replace the attributes hash.
* | Merge pull request #15839 from sgrif/sg-attr-set-nullYves Senn2014-06-226-12/+17
|\ \ | | | | | | Return a null object from `AttributeSet#[]`
| * | Return a null object from `AttributeSet#[]`Sean Griffin2014-06-206-12/+17
| |/
* | Merge pull request #15849 from sgrif/sg-move-attributesYves Senn2014-06-223-3/+14
|\ \ | | | | | | Move `attributes` to the `AttributeSet` object.
| * | Move `attributes` to the `AttributeSet` object.Sean Griffin2014-06-213-3/+14
| |/
* / Add missing test cases for `attribute_method?`Sean Griffin2014-06-211-0/+11
|/
* docs, configurations method is listed in the docs. [ci skip]Yves Senn2014-06-201-1/+0
| | | | | The :singleton-method: directive is printed in the docs. This directive is not necessary as the method is documentable just fine.
* Merge pull request #15728 from sgrif/sg-double-save-hm-tRafael Mendonça França2014-06-193-4/+30
|\ | | | | | | | | | | | | | | Don't save through records twice Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/has_many_through_associations_test.rb
| * Don't save through records twiceSean Griffin2014-06-173-3/+29
| | | | | | | | | | | | | | If the through record gets created in an `after_create` hook that is defined before the association is defined (therefore after its `after_create` hook) get saved twice. This ensures that the through records are created only once, regardless of the order of the hooks.
* | Merge pull request #15747 from sgrif/sg-trolololol-this-is-so-brokenRafael Mendonça França2014-06-193-1/+56
|\ \ | | | | | | Always update counter caches in memory when adding records
| * | Always update counter caches in memory when adding recordsSean Griffin2014-06-163-1/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, calling `size` would only work if it skipped the cache, and would return a different result from the cache, but only if: - The association was previously loaded - Or you called size previously - But only if the size was 0 when you called it This ensures that the counter is appropriately updated in memory.
* | | Merge pull request #15800 from sgrif/sg-column-in-calculationRafael Mendonça França2014-06-192-17/+8
|\ \ \ | | | | | | | | Don't use `Column` for type casting in Relation calculations
| * | | Don't use `Column` for type casting in Relation calculationsSean Griffin2014-06-182-17/+8
| | | |
* | | | Merge pull request #15801 from sgrif/sg-column-defaultsRafael Mendonça França2014-06-191-2/+2
|\ \ \ \ | | | | | | | | | | Don't use column object when calculating type cast defaults
| * | | | Don't use column object when calculating type cast defaultsSean Griffin2014-06-181-2/+2
| |/ / / | | | | | | | | | | | | Moves towards removing type casting knowledge from the column entirely
* | | | Merge pull request #15802 from sgrif/sg-column-quotingRafael Mendonça França2014-06-193-31/+6
|\ \ \ \ | | | | | | | | | | Don't use column object for type casting in `quoting`
| * | | | Don't use column object for type casting in `quoting`Sean Griffin2014-06-183-31/+6
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're never going to be able to use the attribute object here, however, so let's just accept the ugly demeter violation here for now. Remove test cases which were either redundant with other tests in the file, or were actually testing the type objects (which are tested elsewhere)
* | | | Merge pull request #15803 from sgrif/sg-column-in-associationsRafael Mendonça França2014-06-193-5/+5
|\ \ \ \ | | | | | | | | | | Don't rely on the column for type casting reflections
| * | | | Don't rely on the column for type casting reflectionsSean Griffin2014-06-183-5/+5
| |/ / /
* | | | Merge pull request #15814 from sgrif/sg-number-changedRafael Mendonça França2014-06-191-12/+6
|\ \ \ \ | | | | | | | | | | Further simplify `changed?` conditional for numeric types
| * | | | Further simplify `changed?` conditional for numeric typesSean Griffin2014-06-191-12/+6
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | `Type::Integer.new.type_cast('') # => nil`, we do not need a special case to handle this, `nil => ''` already returns false. The only case we need to handle is `0 => 'wibble'` should be changed, while `0 => '0'` should not.
* | | | Merge pull request #15818 from sgrif/sg-attribute-setRafael Mendonça França2014-06-198-23/+120
|\ \ \ \ | | | | | | | | | | Introduce an object to aid in creation and management of `@attributes`
| * | | | Introduce an object to aid in creation and management of `@attributes`Sean Griffin2014-06-198-23/+120
| |/ / / | | | | | | | | | | | | | | | | Mostly delegation to start, but we can start moving a lot of behavior in bulk to this object.
* | | | Merge pull request #15772 from nbudin/sti_through_bugRafael Mendonça França2014-06-193-1/+18
|\ \ \ \ | | | | | | | | | | | | | | | Don't include inheritance column in the through_scope_attributes
| * | | | Don't include inheritance column in the through_scope_attributesNat Budin2014-06-173-2/+17
| | |_|/ | |/| |
* | | | Use a better test descriptionRafael Mendonça França2014-06-191-1/+1
| | | |
* | | | Fix has_and_belongs_to_many in a namespaced model pointing to a non ↵Rafael Mendonça França2014-06-194-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | namespaced model Now the following case will work fine class Tag < ActiveRecord::Base end class Publisher::Article < ActiveRecord::Base has_and_belongs_to_many :tags end Fixes #15761
* | | | this method is no longer being usedJosh Sharpe2014-06-191-4/+0
| |/ / |/| |
* | | Reconnect after possibly enabling hstoreMatthew Draper2014-06-181-0/+2
| | |
* | | Merge pull request #15782 from sgrif/sg-column-defaultsMatthew Draper2014-06-1817-68/+60
|\ \ \ | | | | | | | | Don't type cast the default on the column
| * | | Don't type cast the default on the columnSean Griffin2014-06-1717-68/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If we want to have type decorators mess with the attribute, but not the column, we need to stop type casting on the column. Where possible, we changed the tests to test the value of `column_defaults`, which is public API. `Column#default` is not.
* | | | Detect in-place changes on point typesSean Griffin2014-06-173-3/+31
| | | |
* | | | Enable hstore in array testsSean Griffin2014-06-171-0/+6
| | | |
* | | | Detect mutations of arrays and array membersSean Griffin2014-06-173-12/+41
| | | |
* | | | Ensure `OID::Array#type_cast_for_database` matches PG's quoting behaviorSean Griffin2014-06-174-7/+54
| | | | | | | | | | | | | | | | | | | | | | | | Also takes a step towards supporting types which use a character other than ',' for the delimiter (`box` is the only built in type for which this is the case)
* | | | Merge pull request #15778 from sgrif/sg-pg-mutable-arraysMatthew Draper2014-06-184-38/+62
|\ \ \ \ | | | | | | | | | | Move pg array database type casting to the Array type
| * | | | Move array database type casting to the Array typeSean Griffin2014-06-174-38/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The case where we have a column object, but don't have a type cast method involves type casting the default value when changing the schema. We get one of the column definition structs instead. That is a case that I'm trying to remove overall, but in the short term, we can achieve the same behavior without needing to pass the adapter to the array type by creating a fake type that proxies to the adapter.
* | | | | Merge pull request #15727 from aditya-kapoor/add-tests-for-migrationMatthew Draper2014-06-181-0/+17
|\ \ \ \ \ | |_|/ / / |/| | | | Add test cases for Migration#inverse_of
| * | | | Add test cases for Migration#inverse_ofAditya Kapoor2014-06-171-0/+17
| | |_|/ | |/| |
* | | | Merge pull request #15780 from sgrif/sg-dont-always-save-mutable-typesRafael Mendonça França2014-06-173-2/+4
|\ \ \ \ | | | | | | | | | | Don't assume that Hstore columns have always changed
| * | | | Don't assume that Hstore columns have always changedSean Griffin2014-06-173-2/+4
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HStore columns come back from the database separated by a comma and a space, not just a comma. We need to mirror that behavior since we compare the two values. Also adds a regression test against JSON to ensure we don't have the same bug there.
* / | | Use `column_defaults` in dirty for checking changed defaultsSean Griffin2014-06-171-11/+3
|/ / / | | | | | | | | | | | | | | | We no longer need to "init changed attributes" from the initializer, either, as there is no longer a case where a given value would differ from the default, but would not already be marked as changed.
* | / Don't mess with `column_defaults` when optimistic locking is enabledSean Griffin2014-06-173-12/+32
| |/ |/|
* | add `bin/rake db:purge` task to empty the current database.Yves Senn2014-06-174-0/+55
| |
* | fix typo in test method names. [ci skip]Yves Senn2014-06-171-4/+4
| |
* | Promote time zone aware attributes to a first class type decoratorSean Griffin2014-06-166-32/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | This refactoring revealed the need for another form of decoration, which takes a proc to select which it applies to (There's a *lot* of cases where this form can be used). To avoid duplication, we can re-implement the old decoration in terms of the proc-based decoration. The reason we're `instance_exec`ing the matcher is for cases such as time zone aware attributes, where a decorator is defined in a parent class, and a method called in the matcher is overridden by a child class. The matcher will close over the parent, and evaluate in its context, which is not the behavior we want.
* | Merge pull request #15759 from sgrif/sg-extract-type-decoratorRafael Mendonça França2014-06-161-8/+24
|\ \ | | | | | | Refactor application of type decorators into an object
| * | Refactor application of type decorators into an objectSean Griffin2014-06-161-8/+24
| | |