Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
| * | Don't query the database schema when calling `serialize` | Sean Griffin | 2014-06-07 | 1 | -4/+2 | |
| | | | | | | | | | | | | We need to decorate the types lazily. This is extracted to a separate API, as there are other refactorings that will be able to make use of it, and to allow unit testing the finer points more granularly. | |||||
* | | Merge pull request #15561 from sgrif/sg-time-zone-aware-arrays | Rafael Mendonça França | 2014-06-07 | 1 | -1/+11 | |
|\ \ | | | | | | | Ensure time zones don't change after round trip with array columns | |||||
| * | | Ensure time zones don't change after round trip with array columns | Sean Griffin | 2014-06-07 | 1 | -1/+11 | |
| | | | | | | | | | | | | | | | The times would be equivalent, even if they were in different time zones. E.g. 12:00 UTC == 5:00 PDT | |||||
* | | | Do not type cast twice on attribute assignment | Sean Griffin | 2014-06-07 | 1 | -11/+20 | |
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | The definition of `write_attribute` in dirty checking ultimately leads to the columns calling `type_cast` on the value to perform the comparison. However, this is a potentially expensive computation that we cache when it occurs in `read_attribute`. The only case that we need the non-type-cast form is for numeric, so we pass that through as well (something I'm looking to remove in the future). This also reduces the number of places that manually access various stages in an attribute's type casting lifecycle, which will aid in one of the larger refactorings that I'm working on. | |||||
* | | changelog for #15556 and credit @kuldeepaggarwal [Kuldeep Aggarwal] | Yves Senn | 2014-06-07 | 1 | -2/+0 | |
| | | | | | | | | | | | | This is a follow up to #15556 @kuldeepaggarwal did submit this patch way back (#13624). | |||||
* | | Add array support when time zone aware attributes are enabled | Sean Griffin | 2014-06-07 | 1 | -1/+13 | |
|/ | ||||||
* | Return a null column when no column exists for an attribute | Sean Griffin | 2014-06-03 | 2 | -7/+8 | |
| | ||||||
* | Refactor determination of whether the field has changed | Sean Griffin | 2014-06-03 | 2 | -35/+2 | |
| | | | | | The types know more about what is going on than the dirty module. Let's ask them! | |||||
* | Remove most code related to serialized properties | Sean Griffin | 2014-06-01 | 3 | -58/+7 | |
| | | | | | | | | | | | 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 serialization | Sean Griffin | 2014-06-01 | 1 | -1/+1 | |
| | | | | | | 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. | |||||
* | Rename attribute related instance variables to better express intent | Sean Griffin | 2014-05-30 | 6 | -16/+16 | |
| | | | | | | | | | `@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. | |||||
* | Don't reference comments that do not exist | Sean Griffin | 2014-05-29 | 1 | -2/+0 | |
| | ||||||
* | Move `type_cast_for_write` behavior over to the serialized type object | Sean Griffin | 2014-05-29 | 2 | -48/+8 | |
| | ||||||
* | Refactor serialized types to be partially defined as custom properties | Sean Griffin | 2014-05-29 | 1 | -20/+6 | |
| | | | | | | | 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. | |||||
* | Add an interface for type objects to control Ruby => SQL | Sean Griffin | 2014-05-26 | 2 | -8/+4 | |
| | | | | | Adds the ability to save custom types, which type cast to non-primitive ruby objects. | |||||
* | Merge pull request #14613 from Sirupsen/fix-serialize-update-column | Rafael Mendonça França | 2014-05-21 | 2 | -14/+30 | |
|\ | | | | | | | | | | | | | Fix serialized field returning serialized data after update_column Conflicts: activerecord/CHANGELOG.md | |||||
| * | Fix serialized field returning serialized data after update_column | Simon Eskildsen | 2014-04-05 | 2 | -14/+30 | |
| | | ||||||
* | | Remove :timestamp column type | Sean Griffin | 2014-05-19 | 2 | -4/+4 | |
| | | | | | | | | | | | | | | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`. | |||||
* | | docs, double meaning of `serialize` argument. Closes #14284. | Yves Senn | 2014-04-14 | 1 | -5/+16 | |
|/ | | | | | | | | The second argument to serialize has double meaning: * `class_name` of the Type to serialize * `coder` to use then serializing. The new variable name and the docs better describe that behavior. | |||||
* | [Active Record] Renamed private methods create_record and update_record | Prathamesh Sonpatki | 2014-02-20 | 1 | -2/+2 | |
| | | | | | | This is to ensure that they are not accidentally called by the app code. They are renamed to _create_record and _update_record respectively. Closes #11645 | |||||
* | Aesthetic | Rafael Mendonça França | 2014-01-29 | 1 | -6/+5 | |
| | ||||||
* | Fixing issue with activerecord serialization not being able to dump a record ↵ | Mauricio Linhares | 2014-01-29 | 1 | -0/+11 | |
| | | | | after loading it from YAML - fixes #13861 | |||||
* | Merge pull request #13799 from kbrock/better_dirty | Jeremy Kemper | 2014-01-22 | 2 | -1/+29 | |
|\ | | | | | Better ActiveRecord hierarchy for Dirty and others | |||||
| * | Move changed_attributes into dirty.rb | Keenan Brock | 2014-01-22 | 2 | -1/+29 | |
| | | | | | | Move serialization dirty into serialization.rb | |||||
* | | Add more tests for the dirty feature for enums | Rafael Mendonça França | 2014-01-21 | 1 | -1/+0 | |
| | | ||||||
* | | Extract all attribute changed work to its own method | Rafael Mendonça França | 2014-01-21 | 1 | -3/+7 | |
|/ | | | | This will make easier to hook on this feature to customize the behavior | |||||
* | Fix typo: data --> date | Alex Ghiculescu | 2013-12-19 | 1 | -1/+1 | |
| | ||||||
* | Merge branch 'master' of github.com:rails/docrails | Vijay Dev | 2013-11-07 | 1 | -0/+3 | |
|\ | ||||||
| * | warning about saving models with dirty attributes | Damien Mathieu | 2013-10-23 | 1 | -0/+3 | |
| | | | | | | | | See #8328 | |||||
* | | `ActiveRecord::Store` works together with PG `hstore` columns. | Yves Senn | 2013-10-25 | 1 | -0/+4 | |
|/ | | | | | | This is necessary because as of 5ac2341 `hstore` columns are always stored as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to be an instance of `HashWithIndifferentAccess`, which led to the bug. | |||||
* | Merge pull request #10816 from bogdan/less-dirty-dirty | Rafael Mendonça França | 2013-09-23 | 1 | -9/+6 | |
| | | | | Make AM::Dirty less dirty to plugin into AR or other library | |||||
* | Merge pull request #12188 from SamSaffron/master | Aaron Patterson | 2013-09-11 | 1 | -7/+8 | |
|\ | | | | | Perf: avoid dupes add fallback logic for coders | |||||
| * | Perf: avoid dupes add fallback logic for coders | Sam | 2013-09-11 | 1 | -7/+8 | |
| | | ||||||
* | | Perf: avoid array allocation where not needed | Sam | 2013-08-27 | 1 | -1/+1 | |
|/ | ||||||
* | method transplanting between modules isn't supported on 1.9 | Aaron Patterson | 2013-07-03 | 2 | -10/+51 | |
| | ||||||
* | refactor the method cache objects to have a superclass | Aaron Patterson | 2013-07-03 | 2 | -51/+16 | |
| | ||||||
* | keep a cache of writer methods | Aaron Patterson | 2013-07-03 | 1 | -11/+34 | |
| | ||||||
* | move the reader method cache in to the read module | Aaron Patterson | 2013-07-03 | 1 | -1/+49 | |
| | ||||||
* | keep a cache of the reader methods so we can reuse them | Aaron Patterson | 2013-07-03 | 1 | -34/+2 | |
| | ||||||
* | reduce the amount of code Ruby has to parse | Aaron Patterson | 2013-07-02 | 1 | -3/+8 | |
| | ||||||
* | making the comment more accurate | Aaron Patterson | 2013-07-02 | 1 | -2/+5 | |
| | ||||||
* | stop storing multiple copies of a particular attribute name | Aaron Patterson | 2013-07-02 | 2 | -4/+6 | |
| | ||||||
* | eagerly assign the attribute name cache, remove const_missing | Aaron Patterson | 2013-07-02 | 2 | -0/+4 | |
| | ||||||
* | Removed deprecated methods partial_updates and family | Neeraj Singh | 2013-07-02 | 1 | -11/+0 | |
| | | | | | Removed deprecated methods `partial_updates`, `partial_updates?` and `partial_updates=` | |||||
* | fix serialization type cast when value is already unserialized | Jan Berdajs | 2013-06-05 | 1 | -1/+5 | |
| | ||||||
* | the typecast value should be passed to the serializer. fixes #10830 | Aaron Patterson | 2013-06-05 | 1 | -5/+5 | |
| | ||||||
* | Remove instance level serialized_attributes setting was deprecated. | kennyj | 2013-06-02 | 1 | -7/+0 | |
| | ||||||
* | read_attribute_before_type_cast should accept symbol | Neeraj Singh | 2013-05-11 | 1 | -1/+2 | |
| | ||||||
* | fix :nodoc: mark on AR::AttributeMethods::Serialization [ci skip] | Francesco Rodriguez | 2013-04-12 | 1 | -2/+2 | |
| | ||||||
* | update ActiveRecord::AttributeMethods::Serialization documentation [ci skip] | Francesco Rodriguez | 2013-04-04 | 1 | -0/+7 | |
| |