aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused param 'klass' from AttributeAssignment#read_otherMindaugas Mozūras2014-06-231-2/+2
|
* Merge pull request #15867 from sgrif/sg-rm-column-typesYves Senn2014-06-233-5/+1
|\ | | | | Remove unneeded `@column_types` instance variable
| * Remove unneeded `@column_types` instance variableSean Griffin2014-06-223-5/+1
| | | | | | | | This was used more previously, but other uses have been removed.
* | Merge pull request #15848 from sgrif/sg-remove-deprecationYves Senn2014-06-221-8/+1
|\ \ | |/ |/| Remove old deprecation warning
| * Remove old deprecation warningSean Griffin2014-06-221-8/+1
| | | | | | | | | | This has been around for a couple of versions now, a `NoMethodError` should suffice at this point.
* | `reload` should fully reload attributesSean Griffin2014-06-222-5/+1
|/ | | | | | `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-225-12/+9
|\ | | | | Return a null object from `AttributeSet#[]`
| * Return a null object from `AttributeSet#[]`Sean Griffin2014-06-205-12/+9
| |
* | Move `attributes` to the `AttributeSet` object.Sean Griffin2014-06-212-3/+6
|/
* 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-191-3/+2
|\ | | | | | | | | | | | | | | 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-171-3/+2
| | | | | | | | | | | | | | 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-192-1/+26
|\ \ | | | | | | Always update counter caches in memory when adding records
| * | Always update counter caches in memory when adding recordsSean Griffin2014-06-162-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-191-12/+8
|\ \ \ | | | | | | | | Don't use `Column` for type casting in Relation calculations
| * | | Don't use `Column` for type casting in Relation calculationsSean Griffin2014-06-181-12/+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-192-6/+6
|\ \ \ \ | | | | | | | | | | Don't use column object for type casting in `quoting`
| * | | | Don't use column object for type casting in `quoting`Sean Griffin2014-06-182-6/+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-196-23/+70
|\ \ \ \ | | | | | | | | | | 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-196-23/+70
| |/ / / | | | | | | | | | | | | | | | | 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-191-1/+3
|\ \ \ \ | | | | | | | | | | | | | | | Don't include inheritance column in the through_scope_attributes
| * | | | Don't include inheritance column in the through_scope_attributesNat Budin2014-06-171-1/+1
| | |_|/ | |/| |
* | | | Fix has_and_belongs_to_many in a namespaced model pointing to a non ↵Rafael Mendonça França2014-06-191-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| |/ / |/| |
* | | Merge pull request #15782 from sgrif/sg-column-defaultsMatthew Draper2014-06-184-19/+25
|\ \ \ | | | | | | | | Don't type cast the default on the column
| * | | Don't type cast the default on the columnSean Griffin2014-06-174-19/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-172-3/+20
| | | |
* | | | Detect mutations of arrays and array membersSean Griffin2014-06-171-12/+14
| | | |
* | | | Ensure `OID::Array#type_cast_for_database` matches PG's quoting behaviorSean Griffin2014-06-172-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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 #15780 from sgrif/sg-dont-always-save-mutable-typesRafael Mendonça França2014-06-171-1/+1
|\ \ \ \ | | | | | | | | | | Don't assume that Hstore columns have always changed
| * | | | Don't assume that Hstore columns have always changedSean Griffin2014-06-171-1/+1
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-172-12/+25
|/ /
* | add `bin/rake db:purge` task to empty the current database.Yves Senn2014-06-172-0/+23
| |
* | Promote time zone aware attributes to a first class type decoratorSean Griffin2014-06-164-32/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | |
* | | [ci skip] add API doc for AR Group.Aditya Kapoor2014-06-171-1/+9
|/ /
* | Refactor in-place dirty checking to use the attribute objectSean Griffin2014-06-163-9/+26
| |
* | Merge pull request #13963 from lucas-clemente/pending_migrationsRafael Mendonça França2014-06-161-5/+8
|\ \ | | | | | | Skip migration check if adapter doesn't support it
| * | skip migration check if adapter doesn't support itLucas Clemente2014-04-191-5/+8
| | |
* | | Merge pull request #15722 from akshay-vishnoi/spell-correctZachary Scott2014-06-155-8/+8
|\ \ \ | | | | | | | | [ci skip] /mysql/i -> MySQL, Spell correct in continuation to #15555