aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | 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
| * | | /mysql/i -> MySQL, Spell correct in continuation to #15555Akshay Vishnoi2014-06-145-8/+8
| | | |
* | | | Merge pull request #15723 from akshay-vishnoi/sql-correctionZachary Scott2014-06-151-1/+1
|\ \ \ \ | | | | | | | | | | [ci skip] Use `an` for SQL
| * | | | [ci skip] Use `an` for SQLAkshay Vishnoi2014-06-141-1/+1
| |/ / /
* | | / Change the deprecation warning on `serialized_attributes`Sean Griffin2014-06-151-8/+2
| |_|/ |/| | | | | | | | to "without replacement"
* | | Deprecate `serialized_attributes` without replacementSean Griffin2014-06-141-16/+17
|/ / | | | | | | | | We've stopped using it internally, in favor of polymorphism. So should you!
* | Parsing DATABASE_URI, use URI#hostname: it's smarter about IPv6Matthew Draper2014-06-141-1/+1
| | | | | | | | Fixes #15705.
* | Merge pull request #15702 from sgrif/sg-rm-serializedRafael Mendonça França2014-06-134-14/+2
|\ \ | | | | | | Remove `serialized?` from the type interface
| * | Remove `serialized?` from the type interfaceSean Griffin2014-06-134-14/+2
| | |
* | | Merge pull request #15701 from zzak/issue_15496Rafael Mendonça França2014-06-131-1/+5
|\ \ \ | | | | | | | | Open extension point for defining options in build_through_record
| * | | Open extension point for defining options in build_through_recordZachary Scott2014-06-131-1/+5
| | | | | | | | | | | | | | | | This fixes #15496
* | | | Merge pull request #15694 from sgrif/sg-method-missingRafael Mendonça França2014-06-131-34/+1
|\ \ \ \ | | | | | | | | | | Remove unused `method_missing` definition
| * | | | Remove unused `method_missing` definitionSean Griffin2014-06-131-34/+1
| |/ / / | | | | | | | | | | | | We always define attribute methods in the constructor or in `init_with`.
* | | | Merge pull request #15343 from dontfidget/fix_polymorphic_automatic_inverse_ofRafael Mendonça França2014-06-131-1/+1
|\ \ \ \ | |_|/ / |/| | | prevent bad automatic inverse_of association
| * | | use name specified by 'as' for automatic inverse association to avoid ↵Andrew S. Brown2014-06-101-1/+1
| | | | | | | | | | | | | | | | reflecting on wrong association
* | | | Through associations should set both parent ids on join modelsSean Griffin2014-06-132-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | member = Member.new(club: Club.new) member.save! Before: member.current_membership.club_id # => nil After: member.current_membership.club_id # => club's id
* | | | Merge pull request #15674 from sgrif/sg-mutable-attributesMatthew Draper2014-06-148-35/+104
|\ \ \ \ | | | | | | | | | | Detect in-place changes on mutable AR attributes
| * | | | Detect in-place changes on mutable AR attributesSean Griffin2014-06-138-35/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* | | | | Merge pull request #15695 from sgrif/sg-rm-column-types-overrideRafael Mendonça França2014-06-132-11/+2
|\ \ \ \ \ | |_|_|/ / |/| | | | Remove unused column types override
| * | | | Remove unused column types overrideSean Griffin2014-06-132-11/+2
| | | | |
* | | | | s/variable supplied/value supplied [ci skip]Zachary Scott2014-06-131-2/+1
| | | | |
* | | | | Reword PreparedStatementInvalid example, and use values instead ofZachary Scott2014-06-131-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | variables [ci skip] Thanks to @matthewd for the excellent feedback! :heart:
* | | | | Revert code changes at "Copy edits and code font wrap for Active Record [ci ↵Rafael Mendonça França2014-06-131-1/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | skip]" This partially reverts commit 1a203d5e07f639332880099fab610b886b1742fc. Reason: It was committed by accident
* | | | Merge pull request #15689 from sgrif/sg-attribute-methodsMatthew Draper2014-06-141-0/+1
|\ \ \ \ | | | | | | | | | | Ensure we always define attribute methods
| * | | | Ensure we always define attribute methodsSean Griffin2014-06-131-0/+1
| | | | |
* | | | | Merge pull request #15593 from sgrif/sg-attributeRafael Mendonça França2014-06-1310-67/+114
|\ \ \ \ \ | | | | | | | | | | | | Introduce an Attribute object to handle the type casting dance
| * | | | | Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-1310-67/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types
* | | | | | Copy edits and code font wrap for Active Record [ci skip]Zachary Scott2014-06-132-30/+30
| | | | | |
* | | | | | Specifically talking about Rake the library [ci skip]Zachary Scott2014-06-131-2/+1
| |/ / / / |/| | | |
* | | | | PG arrays should type cast user inputSean Griffin2014-06-131-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We guarantee that `model.value` does not change after `model.save && model.reload`. This requires type casting user input for non-string types.
* | | | | Merge pull request #15677 from sgrif/sg-less-imperative-pkMatthew Draper2014-06-131-3/+4
|\ \ \ \ \ | | | | | | | | | | | | Use a conditional rather than early return in `id`
| * | | | | Use a conditional rather than early return in `id`Sean Griffin2014-06-121-3/+4
| | | | | |
* | | | | | Defer to super, rather than re-implementing Object#hashSean Griffin2014-06-121-1/+5
|/ / / / /
* | / / / Fix performance regression on preloading HABTM associationsSean Griffin2014-06-122-1/+2
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'd spend a lot of time calling `hash` and `eql?` on the join model, which has no primary key. Calling `id` with no primary key is a really slow way to get back `nil`, so we can improve the performance there. However, even with the escape clause, we *still* weren't getting high enough performance, as we were checking the primary key too much. `hash` will always return `nil.hash` for records with no id, and `==` will always return `false`. We can optimize those cases in the HABTM join model.
* | | | Merge pull request #15394 from ↵Yves Senn2014-06-122-1/+7
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | morgoth/fix-automatic-maintaining-test-schema-for-sql-format ActiveRecord::Migration.maintain_test_schema! doesn't work with structure.sql Conflicts: activerecord/CHANGELOG.md