Module: AssociateJsonb::WithStoreAttribute

Extended by:
ActiveSupport::Concern
Defined in:
lib/associate_jsonb/with_store_attribute.rb

Defined Under Namespace

Modules: ClassMethods Classes: InstanceMethodsOnActivation, StoreColumnAttributeTracker

Instance Method Summary collapse

Instance Method Details

#[](k) ⇒ Object



176
177
178
179
180
181
182
# File 'lib/associate_jsonb/with_store_attribute.rb', line 176

def [](k)
  if is_store_column_attribute?(k)
    self.public_send(k)
  else
    super
  end
end

#[]=(k, v) ⇒ Object



184
185
186
187
188
189
190
# File 'lib/associate_jsonb/with_store_attribute.rb', line 184

def []=(k, v)
  if is_store_column_attribute?(k)
    self.public_send(:"#{k}=", v)
  else
    super
  end
end

#is_store_column_attribute?(name) ⇒ Boolean

Returns:

  • (Boolean)


172
173
174
# File 'lib/associate_jsonb/with_store_attribute.rb', line 172

def is_store_column_attribute?(name)
  self.class.is_store_column_attribute?(name)
end