aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/store_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-131-1/+0
| | | | | | | | | | | | | | | 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
* Don't change values in `@raw_attributes` during serializationSean Griffin2014-06-011-14/+0
| | | | | | 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.
* Fix inheritance of stored_attributes (fixes #14672)Jessica Yao2014-05-141-0/+16
| | | | [Brad Bennett, Jessica Yao, & Lakshmi Parthasarathy]
* AestheticRafael Mendonça França2014-01-291-6/+7
|
* Fixing issue with activerecord serialization not being able to dump a record ↵Mauricio Linhares2014-01-291-0/+23
| | | | after loading it from YAML - fixes #13861
* Fix: ActiveRecord::Store TypeError conversion when using YAML coderThales Oliveira2014-01-061-0/+4
| | | | | | | | | | Renaming the test accordingly to its behaviour Adding 'Fixes' statement to changelog Improving tests legibility & changelog Undoing mistakenly removed empty line & further improving changelog
* `stored_attributes` need to be specific to a subclass.Yves Senn2013-10-251-0/+12
| | | | | | | | | | | | | | | | | Currently they are all stored globally in the same `Hash`. This commit forces the creation of a per-class variable if necessary. The behavior was exposed through the following test-case: ``` 1) Failure: StoreTest#test_all_stored_attributes_are_returned [/Users/senny/Projects/rails/activerecord/test/cases/store_test.rb:151]: --- expected +++ actual @@ -1 +1 @@ -[:color, :homepage, :favorite_food] +[:resolution, :color, :homepage, :favorite_food] ```
* Remove unnecessary testcase for instance level stored_attributes.kennyj2013-06-021-5/+0
|
* define Active Record Store accessors in a moduleSergey Nartimov2013-02-111-0/+12
| | | | | | | | | | | | | Allow store accessors to be overrided like other attribute methods, e.g.: class User < ActiveRecord::Base store :settings, accessors: [ :color, :homepage ], coder: JSON def color super || 'red' end end
* Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"Guillermo Iguaran2013-01-181-1/+1
| | | | | This reverts commit 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a, reversing changes made to 5937bd02dee112646469848d7fe8a8bfcef5b4c1.
* User Rails 4 find_byrobertomiranda2013-01-181-1/+1
|
* Namespace HashWithIndifferentAccessAkira Matsuda2013-01-071-4/+3
|
* fix warning: method redefinedkennyj2012-10-021-1/+1
|
* refactor store_accessorMatt Jones2012-09-131-1/+13
|
* correctly flag changed attributes in AR::Store, combine multiple calls to ↵Matt Jones2012-09-051-2/+8
| | | | store_accessor
* Use instance_accessor: false instead of instance_writer.kennyj2012-08-211-3/+2
|
* Added *instance_writer: false* for stored/serialized attributes.kennyj2012-07-071-0/+7
|
* Don't mark the store as changed if an attribute isn't changed.kennyj2012-07-031-0/+5
|
* Remember the stored attributes in a config attribute.Joost Baaij2012-06-181-1/+5
| | | | | | This allows you to retrieve the list of attributes you've defined. Usable for e.g. selects in the view, or interators based on the attributes you wish to store in the serialized column.
* Fix backward compatibility with stored Hash values. Wrap coders to convert ↵Jeremy Kemper2012-05-301-13/+16
| | | | serialized values to indifferent access.
* Convert Hash to HashWithIndifferentAccess in ActiveRecord::Store.Andrey Voronkov2012-05-221-0/+34
| | | | | | | In order to make migration from 3.x apps easier, we should try to convert Hash instances to HashWithIndifferentAccess, to allow accessing values with both symbol and a string. This is follow up to changes in 3c0bf043.
* Custom coders support for ActiveRecord::Store. JSON, YAML, Marshal can be ↵Andrey Voronkov2012-05-091-1/+35
| | | | used out of the box.
* Allow store to be a not null column.Jeremy Walker2012-02-021-2/+11
|
* Fix typoJon Leighton2011-11-301-2/+2
|
* Merge branch 'master' of github.com:rails/railsDavid Heinemeier Hansson2011-10-251-3/+3
|\
| * Rails 4 is just around the corner. Stuck with 1.8 until then.Jeremy Kemper2011-10-131-3/+3
| |
* | Fix that changing a store should mark the store attribute as changedDavid Heinemeier Hansson2011-10-251-0/+5
|/
* Added ActiveRecord::Base.store for declaring simple single-column key/value ↵David Heinemeier Hansson2011-10-131-0/+29
stores [DHH]