Methods

Instance Public methods

store(store_attribute, options = {})

📝 Source code
# File activerecord/lib/active_record/store.rb, line 82
      def store(store_attribute, options = {})
        serialize store_attribute, IndifferentCoder.new(store_attribute, options[:coder])
        store_accessor(store_attribute, options[:accessors]) if options.has_key? :accessors
      end
🔎 See on GitHub

store_accessor(store_attribute, *keys)

📝 Source code
# File activerecord/lib/active_record/store.rb, line 87
      def store_accessor(store_attribute, *keys)
        keys = keys.flatten

        _store_accessors_module.module_eval do
          keys.each do |key|
            define_method("#{key}=") do |value|
              write_store_attribute(store_attribute, key, value)
            end

            define_method(key) do
              read_store_attribute(store_attribute, key)
            end
          end
        end

        # assign new store attribute and create new hash to ensure that each class in the hierarchy
        # has its own hash of stored attributes.
        self.local_stored_attributes ||= {}
        self.local_stored_attributes[store_attribute] ||= []
        self.local_stored_attributes[store_attribute] |= keys
      end
🔎 See on GitHub

stored_attributes()

📝 Source code
# File activerecord/lib/active_record/store.rb, line 117
      def stored_attributes
        parent = superclass.respond_to?(:stored_attributes) ? superclass.stored_attributes : {}
        if local_stored_attributes
          parent.merge!(local_stored_attributes) { |k, a, b| a | b }
        end
        parent
      end
🔎 See on GitHub