1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

20 commits

Author SHA1 Message Date
Sergey Nartimov
9dfef5a46b define Active Record Store accessors in a module
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
2013-02-11 17:00:55 +03:00
Guillermo Iguaran
8aebe30ef4 Revert "Merge pull request #8989 from robertomiranda/use-rails-4-find-by"
This reverts commit 637a7d9d35, reversing
changes made to 5937bd02de.
2013-01-18 09:15:19 -05:00
robertomiranda
7baecc4802 User Rails 4 find_by 2013-01-18 07:56:05 -05:00
Akira Matsuda
c8e632bd9f Namespace HashWithIndifferentAccess 2013-01-07 07:37:23 +09:00
kennyj
df08271f9c fix warning: method redefined 2012-10-02 13:32:54 -03:00
Matt Jones
46873aeded refactor store_accessor 2012-09-13 10:12:11 -04:00
Matt Jones
20f943ffd8 correctly flag changed attributes in AR::Store, combine multiple calls to store_accessor 2012-09-05 11:01:26 -04:00
kennyj
57bef99073 Use instance_accessor: false instead of instance_writer. 2012-08-21 23:40:28 +09:00
kennyj
75322ac5b8 Added *instance_writer: false* for stored/serialized attributes. 2012-07-07 16:36:21 +09:00
kennyj
9196b93111 Don't mark the store as changed if an attribute isn't changed. 2012-07-03 12:19:31 +09:00
Joost Baaij
757f7231cc Remember the stored attributes in a config attribute.
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.
2012-06-18 23:49:48 -03:00
Jeremy Kemper
d5354af114 Fix backward compatibility with stored Hash values. Wrap coders to convert serialized values to indifferent access. 2012-05-30 23:21:57 -07:00
Andrey Voronkov
940c135175 Convert Hash to HashWithIndifferentAccess in ActiveRecord::Store.
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.
2012-05-22 18:08:39 +04:00
Andrey Voronkov
3c0bf0435c Custom coders support for ActiveRecord::Store. JSON, YAML, Marshal can be used out of the box. 2012-05-09 19:20:14 +04:00
Jeremy Walker
58d10e2012 Allow store to be a not null column. 2012-02-02 18:57:15 +00:00
Jon Leighton
4f20eb5908 Fix typo 2011-11-30 23:18:40 +00:00
David Heinemeier Hansson
1d9ab88ee6 Merge branch 'master' of github.com:rails/rails 2011-10-25 17:22:55 -05:00
David Heinemeier Hansson
5daf07704a Fix that changing a store should mark the store attribute as changed 2011-10-25 17:22:52 -05:00
Jeremy Kemper
8cbe826958 Rails 4 is just around the corner. Stuck with 1.8 until then. 2011-10-13 16:11:00 -07:00
David Heinemeier Hansson
85b64f98d1 Added ActiveRecord::Base.store for declaring simple single-column key/value stores [DHH] 2011-10-13 16:24:22 -05:00