aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | use name specified by 'as' for automatic inverse association to avoid ↵Andrew S. Brown2014-06-105-1/+16
| | | | | | | | | | | | | | | | | | | | reflecting on wrong association
* | | | | Through associations should set both parent ids on join modelsSean Griffin2014-06-135-7/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1412-36/+149
|\ \ \ \ \ | | | | | | | | | | | | Detect in-place changes on mutable AR attributes
| * | | | | Detect in-place changes on mutable AR attributesSean Griffin2014-06-1312-36/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | | | | |
* | | | | | Merge pull request #15696 from sgrif/sg-bad-testRafael Mendonça França2014-06-131-2/+2
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | Reorder test which does not represent real world usage
| * | | | | Reorder test which does not represent real world usageSean Griffin2014-06-131-2/+2
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | We don't generally modify our classes at runtime like this. Let's create the instance after the class is created. Original commit doesn't imply that this was intentional behavior.
* | | | | 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-142-0/+9
|\ \ \ \ | | | | | | | | | | Ensure we always define attribute methods
| * | | | Ensure we always define attribute methodsSean Griffin2014-06-132-0/+9
| | | | |
* | | | | Merge pull request #15593 from sgrif/sg-attributeRafael Mendonça França2014-06-1316-88/+225
|\ \ \ \ \ | | | | | | | | | | | | Introduce an Attribute object to handle the type casting dance
| * | | | | Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-1316-88/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-132-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #15678 from sgrif/sg-test-hashMatthew Draper2014-06-131-0/+7
|\ \ \ \ \ | | | | | | | | | | | | Add a test to ensure we don't get a performance regression on #hash
| * | | | | Add a test to ensure we don't get a performance regression on #hashSean Griffin2014-06-121-0/+7
| | | | | |
* | | | | | 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
|/ / / / /
* | | | | Merge pull request #15665 from sgrif/sg-id-perfSean Griffin2014-06-122-1/+2
|\ \ \ \ \ | |_|/ / / |/| | | | Fix performance regression on preloading HABTM associations
| * | | | 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.
* | | | | Update test data which doesn't reflect expected usageSean Griffin2014-06-122-11/+11
|/ / / / | | | | | | | | | | | | | | | | | | | | Topics call `serialize :content`, which means that the values in the database should be YAML encoded, and we would only expect to receive YAML strings to `update_column` and `update_columns`.
* | | | Merge pull request #15394 from ↵Yves Senn2014-06-123-1/+14
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | morgoth/fix-automatic-maintaining-test-schema-for-sql-format ActiveRecord::Migration.maintain_test_schema! doesn't work with structure.sql Conflicts: activerecord/CHANGELOG.md
| * | | | Fixed automatic maintaining test schema to properly handle sql structure ↵Wojciech Wnętrzak2014-06-123-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | schema format. Additionally: * It changes `purge` task on `sqlite3` adapter to recreate database file, to be consistent with other adapters. * Adds `purge` step when loading from `schema.rb`
* | | | | Merge pull request #15647 from sgrif/sg-unused-requireYves Senn2014-06-121-2/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove unused require
| * | | | | Remove unused requireSean Griffin2014-06-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | We're not longer using `ipaddr` in schema dumper
* | | | | | Pluck should work with columns of the same name from different tablesSean Griffin2014-06-113-3/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The column name given by the adapter doesn't include the table namespace, so going through the hashed version of the result set causes overridden keys. Fixes #15649
* | | | | Merge pull request #15582 from sgrif/sg-timestampsRafael Mendonça França2014-06-111-3/+5
|\ \ \ \ \ | | | | | | | | | | | | Refactor determination of max updated timestamp
| * | | | | Refactor determination of max updated timestampSean Griffin2014-06-091-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | `[].max # => nil`
* | | | | | Merge pull request #15630 from eileencodes/refactor-join-keys-on-add_constraintsMatthew Draper2014-06-122-12/+20
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | begin refactoring add_constraints by moving join keys
| * | | | | begin refactoring add_constraints by moving join keyseileencodes2014-06-102-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add_constraints is complicated and difficult to read. This is the beginning of a long process of refactoring this code. First step: moved the join keys out of AssociationScope and into reflection. We then don't need to call `reflection` because now reflection is `self`. `foreign_key` must be named something else because reflection already has a `foreign_key` method and when passed into `JoinKeys` it was getting the wrong assignment. `reflection_foreign_key` seemed to be an appropriate name. I also named `key` `reflection_key` to match `reflection_foreign_key`.
* | | | | | Merge pull request #15429 from sgrif/sg-rm-cached-attributesRafael Mendonça França2014-06-113-73/+24
|\ \ \ \ \ \ | | | | | | | | | | | | | | rm cached attributes
| * | | | | | rm cached attributesSean Griffin2014-06-113-73/+24
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original patch that added this concept can be found [here](https://web.archive.org/web/20090601022739/http://dev.rubyonrails.org/ticket/9767). The current default behavior is to cache everything except serialized columns, unless the user specified otherwise. If anyone were to specify otherwise, many types would actually be completely broken. Still, the method is left in place with a deprecation warning in case anyone is actually still calling this method.
* | | | | | Add has_one? docs [skip ci]Arthur Neves2014-06-111-0/+1
| | | | | |
* | | | | | Merge pull request #15637 from akshay-vishnoi/delete-deprecated-methodSantiago Pastorino2014-06-111-4/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove deprecation warning
| * | | | | | Remove deprecation warningAkshay Vishnoi2014-06-111-4/+0
| |/ / / / /
* | | | | | Merge pull request #15638 from sgrif/sg-column-typesRafael Mendonça França2014-06-111-6/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | Ensure `column_types` returns a type object, and not a column
| * | | | | | Ensure `column_types` returns a type object, and not a columnSean Griffin2014-06-111-6/+10
| |/ / / / /
* / / / / / Remove YAML serialization workaround for columnsSean Griffin2014-06-111-6/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | We are no longer including column objects in YAML serialization, thanks to https://github.com/rails/rails/pull/15621
* | | | | Merge pull request #15621 from sgrif/sg-column-type-decorationsRafael Mendonça França2014-06-102-2/+1
|\ \ \ \ \ | | | | | | | | | | | | No need to decorate columns twice
| * | | | | No need to decorate columns twiceSean Griffin2014-06-102-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We never want result types to override column types, and `decorate_columns` can only affect column types. No need to go through the decoration multiple times, we can just exclude the column types from the result types instead.
* | | | | | remove deprecation call while initializing `ClassCache` objectKuldeep Aggarwal2014-06-112-13/+1
| | | | | |
* | | | | | Remove deprecated method ActiveRecord::Base.quoted_locking_columnAkshay Vishnoi2014-06-103-10/+4
|/ / / / /
* | | | | Merge pull request #15610 from sgrif/silence-warningsRafael Mendonça França2014-06-102-3/+3
|\ \ \ \ \ | | | | | | | | | | | | Fix warnings in tests
| * | | | | Silence warnings in tests.Sean Griffin2014-06-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` activerecord/test/cases/adapters/postgresql/range_test.rb:159: warning: (...) interpreted as grouped expression activerecord/test/cases/finder_test.rb:38: warning: shadowing outer local variable - e activerecord/test/cases/finder_test.rb:43: warning: shadowing outer local variable - e ```
* | | | | | Keep the types of virtual columns after yaml serializationSean Griffin2014-06-104-3/+32
|/ / / / / | | | | | | | | | | | | | | | | | | | | On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us.