Class: Mobility::Backends::ActiveRecord::Jsonb

Inherits:
PgHash
  • Object
show all
Defined in:
lib/mobility/backends/active_record/jsonb.rb

Backend Accessors collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mobility::Backends::ActiveRecord

included

Class Method Details

.build_node(attr, locale) ⇒ Mobility::Plugins::Arel::Nodes::Jsonb

Returns Arel node for value of attribute key on jsonb column.

Parameters:

  • Attribute name

  • Locale

Returns:

  • Arel node for value of attribute key on jsonb column



37
38
39
40
# File 'lib/mobility/backends/active_record/jsonb.rb', line 37

def self.build_node(attr, locale)
  column_name = column_affix % attr
  Plugins::Arel::Nodes::Jsonb.new(model_class.arel_table[column_name], build_quoted(locale))
end

Instance Method Details

#read(locale, **options) ⇒ String, ...

Note:

Translation may be any json type, but querying will only work on string-typed values.

Returns Value of translation.

Parameters:

  • Locale to read

Returns:

  • Value of translation



# File 'lib/mobility/backends/active_record/jsonb.rb', line 15


#write(locale, value, **options) ⇒ String, ...

Note:

Translation may be any json type, but querying will only work on string-typed values.

Returns Updated value.

Parameters:

  • Locale to write

  • Value to write

Returns:

  • Updated value



# File 'lib/mobility/backends/active_record/jsonb.rb', line 24