Sha256: 221fa8d2cd9d839a6453aa5f60d02851f8d55c2391bad925dc905601783ec3fc
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'mobility/backends/active_record/pg_hash' require 'mobility/arel/nodes/pg_ops' module Mobility module Backends =begin Implements the {Mobility::Backends::Hstore} backend for ActiveRecord models. @see Mobility::Backends::HashValued =end module ActiveRecord class Hstore < PgHash # @!group Backend Accessors # @!macro backend_reader # @!method read(locale, options = {}) # @!macro backend_writer def write(locale, value, options = {}) super(locale, value && value.to_s, options) end # @!endgroup # @param [String] attr Attribute name # @param [Symbol] locale Locale # @return [Mobility::Arel::Nodes::Hstore] Arel node for value of # attribute key on hstore column def self.build_node(attr, locale) column_name = column_affix % attr Arel::Nodes::Hstore.new(model_class.arel_table[column_name], build_quoted(locale)) end end end register_backend(:active_record_hstore, ActiveRecord::Hstore) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mobility-1.0.0.alpha | lib/mobility/backends/active_record/hstore.rb |