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



171
172
173
174
175
176
177
# File 'lib/associate_jsonb/with_store_attribute.rb', line 171

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

#[]=(k, v) ⇒ Object



179
180
181
182
183
184
185
# File 'lib/associate_jsonb/with_store_attribute.rb', line 179

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)


167
168
169
# File 'lib/associate_jsonb/with_store_attribute.rb', line 167

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